summaryrefslogtreecommitdiffstats
path: root/WebKitTools/DumpRenderTree/chromium
diff options
context:
space:
mode:
Diffstat (limited to 'WebKitTools/DumpRenderTree/chromium')
-rw-r--r--WebKitTools/DumpRenderTree/chromium/CppVariant.h2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp18
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h6
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h11
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp16
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp9
-rw-r--r--WebKitTools/DumpRenderTree/chromium/EventSender.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp33
-rw-r--r--WebKitTools/DumpRenderTree/chromium/LayoutTestController.h18
-rw-r--r--WebKitTools/DumpRenderTree/chromium/MockSpellCheck.h2
-rw-r--r--WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h4
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestNavigationController.cpp28
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestNavigationController.h39
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.cpp28
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShell.h1
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp9
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellMac.mm10
-rw-r--r--WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp5
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp51
-rw-r--r--WebKitTools/DumpRenderTree/chromium/WebViewHost.h9
22 files changed, 203 insertions, 108 deletions
diff --git a/WebKitTools/DumpRenderTree/chromium/CppVariant.h b/WebKitTools/DumpRenderTree/chromium/CppVariant.h
index d34a163..3aa5abb 100644
--- a/WebKitTools/DumpRenderTree/chromium/CppVariant.h
+++ b/WebKitTools/DumpRenderTree/chromium/CppVariant.h
@@ -42,8 +42,8 @@
#ifndef CppVariant_h
#define CppVariant_h
-#include "base/basictypes.h"
#include "public/WebBindings.h"
+#include "webkit/support/webkit_support.h"
#include <string>
#include <wtf/Vector.h>
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
index 0ff77a0..b05fe21 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.cpp
@@ -36,7 +36,6 @@
#include "public/WebCString.h"
#include "public/WebDevToolsAgent.h"
-#include "public/WebDevToolsMessageData.h"
#include "public/WebString.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
@@ -55,12 +54,17 @@ DRTDevToolsAgent::DRTDevToolsAgent()
WebDevToolsAgent::setMessageLoopDispatchHandler(&DRTDevToolsAgent::dispatchMessageLoop);
}
+void DRTDevToolsAgent::reset()
+{
+ m_callMethodFactory.RevokeAll();
+}
+
void DRTDevToolsAgent::setWebView(WebView* webView)
{
m_webView = webView;
}
-void DRTDevToolsAgent::sendMessageToFrontend(const WebDevToolsMessageData& data)
+void DRTDevToolsAgent::sendMessageToInspectorFrontend(const WebKit::WebString& data)
{
if (m_drtDevToolsClient)
m_drtDevToolsClient->asyncCall(DRTDevToolsCallArgs(data));
@@ -100,7 +104,7 @@ void DRTDevToolsAgent::call(const DRTDevToolsCallArgs &args)
{
WebDevToolsAgent* agent = webDevToolsAgent();
if (agent)
- agent->dispatchMessageFromFrontend(args.m_data);
+ agent->dispatchOnInspectorBackend(args.m_data);
if (DRTDevToolsCallArgs::callsCount() == 1 && m_drtDevToolsClient)
m_drtDevToolsClient->allMessagesProcessed();
}
@@ -121,7 +125,7 @@ void DRTDevToolsAgent::attach(DRTDevToolsClient* client)
agent->attach();
}
-void DRTDevToolsAgent::detach(DRTDevToolsClient* client)
+void DRTDevToolsAgent::detach()
{
ASSERT(m_drtDevToolsClient);
WebDevToolsAgent* agent = webDevToolsAgent();
@@ -130,6 +134,12 @@ void DRTDevToolsAgent::detach(DRTDevToolsClient* client)
m_drtDevToolsClient = 0;
}
+void DRTDevToolsAgent::frontendLoaded() {
+ WebDevToolsAgent* agent = webDevToolsAgent();
+ if (agent)
+ agent->frontendLoaded();
+}
+
bool DRTDevToolsAgent::setTimelineProfilingEnabled(bool enabled)
{
WebDevToolsAgent* agent = webDevToolsAgent();
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
index 37fc119..df52866 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsAgent.h
@@ -52,11 +52,12 @@ class DRTDevToolsAgent : public WebKit::WebDevToolsAgentClient
public:
DRTDevToolsAgent();
virtual ~DRTDevToolsAgent() {}
+ void reset();
void setWebView(WebKit::WebView*);
// WebDevToolsAgentClient implementation.
- virtual void sendMessageToFrontend(const WebKit::WebDevToolsMessageData&);
+ virtual void sendMessageToInspectorFrontend(const WebKit::WebString&);
virtual int hostIdentifier() { return m_routingID; }
virtual void forceRepaint();
virtual void runtimeFeatureStateChanged(const WebKit::WebString& feature, bool enabled);
@@ -67,7 +68,8 @@ public:
void asyncCall(const DRTDevToolsCallArgs&);
void attach(DRTDevToolsClient*);
- void detach(DRTDevToolsClient*);
+ void detach();
+ void frontendLoaded();
bool evaluateInWebInspector(long callID, const std::string& script);
bool setTimelineProfilingEnabled(bool enable);
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
index e4a3d48..b1ac2ec 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsCallArgs.h
@@ -31,22 +31,15 @@
#ifndef DRTDevToolsCallArgs_h
#define DRTDevToolsCallArgs_h
-#include "public/WebDevToolsMessageData.h"
#include "public/WebString.h"
#include <wtf/Assertions.h>
class DRTDevToolsCallArgs {
public:
- DRTDevToolsCallArgs(const WebKit::WebDevToolsMessageData& data)
+ DRTDevToolsCallArgs(const WebKit::WebString& data)
: m_data(data)
{
++m_callsCount;
-
- // The same behaviour as we have in case of IPC.
- for (size_t i = 0; i < m_data.arguments.size(); ++i) {
- if (m_data.arguments[i].isNull())
- m_data.arguments[i] = WebKit::WebString::fromUTF8("");
- }
}
DRTDevToolsCallArgs(const DRTDevToolsCallArgs& args)
@@ -63,7 +56,7 @@ public:
static int callsCount() { return m_callsCount; }
- WebKit::WebDevToolsMessageData m_data;
+ WebKit::WebString m_data;
private:
static int m_callsCount;
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
index e14f008..42f3724 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.cpp
@@ -61,10 +61,20 @@ DRTDevToolsClient::~DRTDevToolsClient()
// m_drtDevToolsAgent and we should clean pending requests a bit earlier.
m_callMethodFactory.RevokeAll();
if (m_drtDevToolsAgent)
- m_drtDevToolsAgent->detach(this);
+ m_drtDevToolsAgent->detach();
}
-void DRTDevToolsClient::sendMessageToAgent(const WebDevToolsMessageData& data)
+void DRTDevToolsClient::reset()
+{
+ m_callMethodFactory.RevokeAll();
+}
+
+void DRTDevToolsClient::sendFrontendLoaded() {
+ if (m_drtDevToolsAgent)
+ m_drtDevToolsAgent->frontendLoaded();
+}
+
+void DRTDevToolsClient::sendMessageToBackend(const WebString& data)
{
if (m_drtDevToolsAgent)
m_drtDevToolsAgent->asyncCall(DRTDevToolsCallArgs(data));
@@ -103,7 +113,7 @@ void DRTDevToolsClient::asyncCall(const DRTDevToolsCallArgs& args)
void DRTDevToolsClient::call(const DRTDevToolsCallArgs& args)
{
- m_webDevToolsFrontend->dispatchMessageFromAgent(args.m_data);
+ m_webDevToolsFrontend->dispatchOnInspectorFrontend(args.m_data);
if (DRTDevToolsCallArgs::callsCount() == 1)
allMessagesProcessed();
}
diff --git a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
index f08644b..37b1e9d 100644
--- a/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
+++ b/WebKitTools/DumpRenderTree/chromium/DRTDevToolsClient.h
@@ -53,9 +53,11 @@ class DRTDevToolsClient : public WebKit::WebDevToolsFrontendClient
public:
DRTDevToolsClient(DRTDevToolsAgent*, WebKit::WebView*);
virtual ~DRTDevToolsClient();
+ void reset();
// WebDevToolsFrontendClient implementation
- virtual void sendMessageToAgent(const WebKit::WebDevToolsMessageData&);
+ virtual void sendFrontendLoaded();
+ virtual void sendMessageToBackend(const WebKit::WebString&);
virtual void sendDebuggerCommandToAgent(const WebKit::WebString& command);
virtual void activateWindow();
diff --git a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
index 2885cf6..726e412 100644
--- a/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/DumpRenderTree.cpp
@@ -36,8 +36,6 @@
using namespace std;
-void platformInit();
-
static const char optionComplexText[] = "--complex-text";
static const char optionDumpAllPixels[] = "--dump-all-pixels";
static const char optionNotree[] = "--notree";
@@ -48,6 +46,7 @@ static const char optionTree[] = "--tree";
static const char optionPixelTestsWithName[] = "--pixel-tests=";
static const char optionTestShell[] = "--test-shell";
static const char optionAllowExternalPages[] = "--allow-external-pages";
+static const char optionStartupDialog[] = "--testshell-startup-dialog";
static void runTest(TestShell& shell, TestParams& params, const string& testName, bool testShellMode)
{
@@ -91,6 +90,7 @@ int main(int argc, char* argv[])
bool serverMode = false;
bool testShellMode = false;
bool allowExternalPages = false;
+ bool startupDialog = false;
for (int i = 1; i < argc; ++i) {
string argument(argv[i]);
if (argument == "-")
@@ -107,6 +107,8 @@ int main(int argc, char* argv[])
serverMode = true;
} else if (argument == optionAllowExternalPages)
allowExternalPages = true;
+ else if (argument == optionStartupDialog)
+ startupDialog = true;
else if (argument.size() && argument[0] == '-')
fprintf(stderr, "Unknown option: %s\n", argv[i]);
else
@@ -117,6 +119,9 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
+ if (startupDialog)
+ openStartupDialog();
+
{ // Explicit scope for the TestShell instance.
TestShell shell(testShellMode);
shell.setAllowExternalPages(allowExternalPages);
diff --git a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
index 4e84c96..bb3c07f 100644
--- a/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/EventSender.cpp
@@ -45,7 +45,6 @@
#include "TestShell.h"
#include "base/keyboard_codes.h"
-#include "base/time.h"
#include "public/WebDragData.h"
#include "public/WebDragOperation.h"
#include "public/WebPoint.h"
@@ -124,7 +123,7 @@ static uint32 timeOffsetMs = 0;
static double getCurrentEventTimeSec()
{
- return (TimeTicks::Now().ToInternalValue() / Time::kMicrosecondsPerMillisecond + timeOffsetMs) / 1000.0;
+ return (webkit_support::GetCurrentTimeInMillisecond() + timeOffsetMs) / 1000.0;
}
static void advanceEventTime(int32_t deltaMs)
@@ -324,6 +323,7 @@ void EventSender::reset()
timeOffsetMs = 0;
touchModifiers = 0;
touchPoints.clear();
+ m_methodFactory.RevokeAll();
}
WebView* EventSender::webview()
diff --git a/WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp b/WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp
index 27e9946..d1adc3d 100644
--- a/WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/ImageDiff.cpp
@@ -321,12 +321,12 @@ static bool writeFile(const char* outFile, const unsigned char* data, size_t dat
{
FILE* file = fopen(outFile, "wb");
if (!file) {
- fprintf(stderr, "ImageDiff: Unable to create file \"%s\"\n", file);
+ fprintf(stderr, "ImageDiff: Unable to create file \"%s\"\n", outFile);
return false;
}
if (dataSize != fwrite(data, 1, dataSize, file)) {
fclose(file);
- fprintf(stderr, "ImageDiff: Unable to write data to file \"%s\"\n", file);
+ fprintf(stderr, "ImageDiff: Unable to write data to file \"%s\"\n", outFile);
return false;
}
fclose(file);
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
index cd27c18..e82a65e 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.cpp
@@ -47,6 +47,7 @@
#include "public/WebSecurityPolicy.h"
#include "public/WebSettings.h"
#include "public/WebSize.h"
+#include "public/WebSpeechInputControllerMock.h"
#include "public/WebURL.h"
#include "public/WebView.h"
#include "webkit/support/webkit_support.h"
@@ -154,6 +155,8 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebViews);
bindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrowsingEnabled);
bindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode);
+ bindMethod("clearAllApplicationCaches", &LayoutTestController::clearAllApplicationCaches);
+ bindMethod("setApplicationCacheOriginQuota", &LayoutTestController::setApplicationCacheOriginQuota);
bindMethod("setJavaScriptCanAccessClipboard", &LayoutTestController::setJavaScriptCanAccessClipboard);
bindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled);
@@ -172,6 +175,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
bindMethod("setMockGeolocationPosition", &LayoutTestController::setMockGeolocationPosition);
bindMethod("setMockGeolocationError", &LayoutTestController::setMockGeolocationError);
bindMethod("abortModal", &LayoutTestController::abortModal);
+ bindMethod("setMockSpeechInputResult", &LayoutTestController::setMockSpeechInputResult);
// The fallback method is called when an unknown method is invoked.
bindFallbackMethod(&LayoutTestController::fallbackMethod);
@@ -510,6 +514,7 @@ void LayoutTestController::reset()
else
m_closeRemainingWindows = true;
m_workQueue.reset();
+ m_timeoutFactory.RevokeAll();
}
void LayoutTestController::locationChangeDone()
@@ -648,6 +653,18 @@ void LayoutTestController::setUseDashboardCompatibilityMode(const CppArgumentLis
result->setNull();
}
+void LayoutTestController::clearAllApplicationCaches(const CppArgumentList&, CppVariant* result)
+{
+ // FIXME: implement to support Application Cache Quotas.
+ result->setNull();
+}
+
+void LayoutTestController::setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant* result)
+{
+ // FIXME: implement to support Application Cache Quotas.
+ result->setNull();
+}
+
void LayoutTestController::setScrollbarPolicy(const CppArgumentList&, CppVariant* result)
{
// FIXME: implement.
@@ -1355,3 +1372,19 @@ void LayoutTestController::abortModal(const CppArgumentList& arguments, CppVaria
{
result->setNull();
}
+
+void LayoutTestController::setMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)
+{
+ result->setNull();
+ if (arguments.size() < 1 || !arguments[0].isString())
+ return;
+
+ m_speechInputControllerMock->setMockRecognitionResult(cppVariantToWebString(arguments[0]));
+}
+
+WebKit::WebSpeechInputController* LayoutTestController::speechInputController(WebKit::WebSpeechInputListener* listener)
+{
+ if (!m_speechInputControllerMock.get())
+ m_speechInputControllerMock.set(WebSpeechInputControllerMock::create(listener));
+ return m_speechInputControllerMock.get();
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
index 6748352..fb91544 100644
--- a/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/chromium/LayoutTestController.h
@@ -46,6 +46,13 @@
#include "public/WebString.h"
#include "public/WebURL.h"
#include <wtf/Deque.h>
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+class WebSpeechInputController;
+class WebSpeechInputControllerMock;
+class WebSpeechInputListener;
+}
class TestShell;
@@ -250,6 +257,11 @@ public:
void addOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
void removeOriginAccessWhitelistEntry(const CppArgumentList&, CppVariant*);
+ // Clears all Application Caches.
+ void clearAllApplicationCaches(const CppArgumentList&, CppVariant*);
+ // Sets the Application Quota for the localhost origin.
+ void setApplicationCacheOriginQuota(const CppArgumentList&, CppVariant*);
+
// Clears all databases.
void clearAllDatabases(const CppArgumentList&, CppVariant*);
// Sets the default quota for all origins
@@ -293,10 +305,14 @@ public:
// Empty stub method to keep parity with object model exposed by global LayoutTestController.
void abortModal(const CppArgumentList&, CppVariant*);
+ // Speech input related functions.
+ void setMockSpeechInputResult(const CppArgumentList&, CppVariant*);
+
public:
// The following methods are not exposed to JavaScript.
void setWorkQueueFrozen(bool frozen) { m_workQueue.setFrozen(frozen); }
+ WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
bool shouldDumpAsText() { return m_dumpAsText; }
bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
@@ -467,6 +483,8 @@ private:
CppVariant m_webHistoryItemCount;
WebKit::WebURL m_userStyleSheetLocation;
+
+ OwnPtr<WebKit::WebSpeechInputControllerMock> m_speechInputControllerMock;
};
#endif // LayoutTestController_h
diff --git a/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.h b/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.h
index 8c2ba92..c680340 100644
--- a/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.h
+++ b/WebKitTools/DumpRenderTree/chromium/MockSpellCheck.h
@@ -73,7 +73,7 @@ private:
bool initializeIfNeeded();
// A table that consists of misspelled words.
- HashMap<WebCore::String, bool> m_misspelledWords;
+ HashMap<WTF::String, bool> m_misspelledWords;
// A flag representing whether or not this object is initialized.
bool m_initialized;
diff --git a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
index f30862f..5c7a400 100644
--- a/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
+++ b/WebKitTools/DumpRenderTree/chromium/NotificationPresenter.h
@@ -61,10 +61,10 @@ private:
TestShell* m_shell;
// Set of allowed origins.
- HashSet<WebCore::String> m_allowedOrigins;
+ HashSet<WTF::String> m_allowedOrigins;
// Map of active replacement IDs to the titles of those notifications
- HashMap<WebCore::String, WebCore::String> m_replacements;
+ HashMap<WTF::String, WTF::String> m_replacements;
};
#endif // NotificationPresenter_h
diff --git a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.cpp b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.cpp
index 8b4f954..9653c07 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.cpp
@@ -40,6 +40,17 @@ using namespace std;
// ----------------------------------------------------------------------------
// TestNavigationEntry
+PassRefPtr<TestNavigationEntry> TestNavigationEntry::create()
+{
+ return adoptRef(new TestNavigationEntry);
+}
+
+PassRefPtr<TestNavigationEntry> TestNavigationEntry::create(
+ int pageID, const WebURL& url, const WebString& title, const WebString& targetFrame)
+{
+ return adoptRef(new TestNavigationEntry(pageID, url, title, targetFrame));
+}
+
TestNavigationEntry::TestNavigationEntry()
: m_pageID(-1) {}
@@ -136,7 +147,7 @@ TestNavigationEntry* TestNavigationController::lastCommittedEntry() const
TestNavigationEntry* TestNavigationController::activeEntry() const
{
- TestNavigationEntry* entry = m_pendingEntry;
+ TestNavigationEntry* entry = m_pendingEntry.get();
if (!entry)
entry = lastCommittedEntry();
return entry;
@@ -182,14 +193,14 @@ void TestNavigationController::didNavigateToEntry(TestNavigationEntry* entry)
m_entries[existingEntryIndex].get() : 0;
if (!existingEntry) {
// No existing entry, then simply ignore this navigation!
- } else if (existingEntry == m_pendingEntry) {
+ } else if (existingEntry == m_pendingEntry.get()) {
// The given entry might provide a new URL... e.g., navigating back to a
// page in session history could have resulted in a new client redirect.
existingEntry->setURL(entry->URL());
existingEntry->setContentState(entry->contentState());
m_lastCommittedEntryIndex = m_pendingEntryIndex;
m_pendingEntryIndex = -1;
- m_pendingEntry = 0;
+ m_pendingEntry.clear();
} else if (m_pendingEntry && m_pendingEntry->pageID() == -1
&& GURL(m_pendingEntry->URL()) == GURL(existingEntry->URL().spec())) {
// Not a new navigation
@@ -206,15 +217,12 @@ void TestNavigationController::didNavigateToEntry(TestNavigationEntry* entry)
m_lastCommittedEntryIndex = existingEntryIndex;
}
- delete entry;
updateMaxPageID();
}
void TestNavigationController::discardPendingEntry()
{
- if (m_pendingEntryIndex == -1)
- delete m_pendingEntry;
- m_pendingEntry = 0;
+ m_pendingEntry.clear();
m_pendingEntryIndex = -1;
}
@@ -231,7 +239,7 @@ void TestNavigationController::insertEntry(TestNavigationEntry* entry)
}
}
- m_entries.append(linked_ptr<TestNavigationEntry>(entry));
+ m_entries.append(RefPtr<TestNavigationEntry>(entry));
m_lastCommittedEntryIndex = static_cast<int>(m_entries.size()) - 1;
updateMaxPageID();
}
@@ -250,10 +258,10 @@ void TestNavigationController::navigateToPendingEntry(bool reload)
// For session history navigations only the pending_entry_index_ is set.
if (!m_pendingEntry) {
ASSERT(m_pendingEntryIndex != -1);
- m_pendingEntry = m_entries[m_pendingEntryIndex].get();
+ m_pendingEntry = m_entries[m_pendingEntryIndex];
}
- if (m_host->navigate(*m_pendingEntry, reload)) {
+ if (m_host->navigate(*m_pendingEntry.get(), reload)) {
// Note: this is redundant if navigation completed synchronously because
// DidNavigateToEntry call this as well.
updateMaxPageID();
diff --git a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h
index bd3c2f4..d75c3bf 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestNavigationController.h
@@ -31,13 +31,14 @@
#ifndef TestNavigationController_h
#define TestNavigationController_h
-#include "base/basictypes.h"
-#include "base/linked_ptr.h"
#include "public/WebDataSource.h"
#include "public/WebHistoryItem.h"
#include "public/WebString.h"
#include "public/WebURL.h"
+#include "webkit/support/webkit_support.h"
#include <string>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
// Associated with browser-initated navigations to hold tracking data.
@@ -56,16 +57,17 @@ public:
};
// Stores one back/forward navigation state for the test shell.
-class TestNavigationEntry: public Noncopyable {
+class TestNavigationEntry: public RefCounted<TestNavigationEntry> {
public:
- TestNavigationEntry();
- TestNavigationEntry(int pageID,
- const WebKit::WebURL&,
- const WebKit::WebString& title,
- const WebKit::WebString& targetFrame);
+ static PassRefPtr<TestNavigationEntry> create();
+ static PassRefPtr<TestNavigationEntry> create(
+ int pageID,
+ const WebKit::WebURL&,
+ const WebKit::WebString& title,
+ const WebKit::WebString& targetFrame);
// Virtual to allow test_shell to extend the class.
- ~TestNavigationEntry();
+ virtual ~TestNavigationEntry();
// Set / Get the URI
void setURL(const WebKit::WebURL& url) { m_url = url; }
@@ -86,6 +88,12 @@ public:
const WebKit::WebString& targetFrame() const { return m_targetFrame; }
private:
+ TestNavigationEntry();
+ TestNavigationEntry(int pageID,
+ const WebKit::WebURL&,
+ const WebKit::WebString& title,
+ const WebKit::WebString& targetFrame);
+
// Describes the current page that the tab represents. This is not relevant
// for all tab contents types.
int32_t m_pageID;
@@ -120,8 +128,7 @@ public:
// Causes the controller to go to the specified index.
void goToIndex(int);
- // Causes the controller to load the specified entry. The controller
- // assumes ownership of the entry.
+ // Causes the controller to load the specified entry.
// NOTE: Do not pass an entry that the controller already owns!
void loadEntry(TestNavigationEntry*);
@@ -156,9 +163,9 @@ public:
// Returns the index of the last committed entry.
int lastCommittedEntryIndex() const { return m_lastCommittedEntryIndex; }
- // Used to inform us of a navigation being committed for a tab. We will take
- // ownership of the entry. Any entry located forward to the current entry will
- // be deleted. The new entry becomes the current entry.
+ // Used to inform us of a navigation being committed for a tab. Any entry
+ // located forward to the current entry will be deleted. The new entry
+ // becomes the current entry.
void didNavigateToEntry(TestNavigationEntry*);
// Used to inform us to discard its pending entry.
@@ -180,14 +187,14 @@ private:
void updateMaxPageID();
// List of NavigationEntry for this tab
- typedef Vector<linked_ptr<TestNavigationEntry> > NavigationEntryList;
+ typedef Vector<RefPtr<TestNavigationEntry> > NavigationEntryList;
typedef NavigationEntryList::iterator NavigationEntryListIterator;
NavigationEntryList m_entries;
// An entry we haven't gotten a response for yet. This will be discarded
// when we navigate again. It's used only so we know what the currently
// displayed tab is.
- TestNavigationEntry* m_pendingEntry;
+ RefPtr<TestNavigationEntry> m_pendingEntry;
// currently visible entry
int m_lastCommittedEntryIndex;
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
index 507f084..64c20b0 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.cpp
@@ -35,10 +35,8 @@
#include "DRTDevToolsClient.h"
#include "LayoutTestController.h"
#include "WebViewHost.h"
-#include "base/md5.h" // FIXME: Wrap by webkit_support.
#include "base/string16.h"
#include "gfx/codec/png_codec.h" // FIXME: Remove dependecy. WebCore/platform/image-encoder is better?
-#include "net/base/escape.h" // FIXME: Remove dependency.
#include "public/WebDataSource.h"
#include "public/WebDocument.h"
#include "public/WebElement.h"
@@ -48,6 +46,7 @@
#include "public/WebScriptController.h"
#include "public/WebSettings.h"
#include "public/WebSize.h"
+#include "public/WebSpeechInputControllerMock.h"
#include "public/WebString.h"
#include "public/WebURLRequest.h"
#include "public/WebURLResponse.h"
@@ -58,6 +57,7 @@
#include <algorithm>
#include <cctype>
#include <vector>
+#include <wtf/MD5.h>
using namespace WebKit;
using namespace std;
@@ -278,6 +278,9 @@ void TestShell::resetTestController()
m_eventSender->reset();
m_webViewHost->reset();
m_notificationPresenter->reset();
+ m_drtDevToolsAgent->reset();
+ if (m_drtDevToolsClient)
+ m_drtDevToolsClient->reset();
}
void TestShell::loadURL(const WebURL& url)
@@ -422,7 +425,7 @@ static string dumpHistoryItem(const WebHistoryItem& item, int indent, bool isCur
url.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
} else if (!url.find(dataUrlPattern)) {
// URL-escape data URLs to match results upstream.
- string path = EscapePath(url.substr(dataUrlPatternSize));
+ string path = webkit_support::EscapePath(url.substr(dataUrlPatternSize));
url.replace(dataUrlPatternSize, url.length(), path);
}
@@ -585,13 +588,18 @@ void TestShell::dumpImage(skia::PlatformCanvas* canvas) const
// some images that are the pixel identical on windows and other platforms
// but have different MD5 sums. At this point, rebaselining all the windows
// tests is too much of a pain, so we just check in different baselines.
- MD5Context ctx;
- MD5Init(&ctx);
- MD5Update(&ctx, sourceBitmap.getPixels(), sourceBitmap.getSize());
-
- MD5Digest digest;
- MD5Final(&digest, &ctx);
- string md5hash = MD5DigestToBase16(digest);
+ MD5 digester;
+ Vector<uint8_t, 16> digestValue;
+ digester.addBytes(reinterpret_cast<const uint8_t*>(sourceBitmap.getPixels()), sourceBitmap.getSize());
+ digester.checksum(digestValue);
+ string md5hash;
+ md5hash.reserve(16 * 2);
+ for (unsigned i = 0; i < 16; ++i) {
+ char hex[3];
+ // Use "x", not "X". The string must be lowercased.
+ sprintf(hex, "%02x", digestValue[i]);
+ md5hash.append(hex);
+ }
// Only encode and dump the png if the hashes don't match. Encoding the image
// is really expensive.
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShell.h b/WebKitTools/DumpRenderTree/chromium/TestShell.h
index 0615552..47261a3 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShell.h
+++ b/WebKitTools/DumpRenderTree/chromium/TestShell.h
@@ -185,5 +185,6 @@ private:
};
void platformInit(int*, char***);
+void openStartupDialog();
#endif // TestShell_h
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
index a9d374c..56ee618 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellGtk.cpp
@@ -194,3 +194,12 @@ void platformInit(int* argc, char*** argv)
setupFontconfig();
}
+
+void openStartupDialog()
+{
+ GtkWidget* dialog = gtk_message_dialog_new(
+ 0, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, "Attach to me?");
+ gtk_window_set_title(GTK_WINDOW(dialog), "DumpRenderTree");
+ gtk_dialog_run(GTK_DIALOG(dialog)); // Runs a nested message loop.
+ gtk_widget_destroy(dialog);
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
index 19cfd07..71d990e 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellMac.mm
@@ -127,3 +127,13 @@ void TestShell::waitTestFinished()
void platformInit(int*, char***)
{
}
+
+void openStartupDialog()
+{
+ // FIXME: This code doesn't work. Need NSApplication event loop?
+ NSAlert* alert = [[[NSAlert alloc] init] autorelease];
+ alert.messageText = @"Attach to me?";
+ alert.informativeText = @"This would probably be a good time to attach your debugger.";
+ [alert addButtonWithTitle:@"OK"];
+ [alert runModal];
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
index 72f800c..0d818c4 100644
--- a/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/TestShellWin.cpp
@@ -149,3 +149,8 @@ void platformInit(int*, char***)
}
// We don't need to release the font explicitly.
}
+
+void openStartupDialog()
+{
+ ::MessageBox(0, L"Attach to me?", L"DumpRenderTree", MB_OK);
+}
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
index c57aeb5..a145bf9 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.cpp
@@ -35,7 +35,6 @@
#include "TestNavigationController.h"
#include "TestShell.h"
#include "TestWebWorker.h"
-#include "net/base/net_errors.h" // FIXME: can we remove this?
#include "public/WebCString.h"
#include "public/WebConsoleMessage.h"
#include "public/WebContextMenuData.h"
@@ -166,35 +165,6 @@ static void printResponseDescription(const WebURLResponse& response)
response.httpStatusCode());
}
-static void printErrorDescription(const WebURLError& error)
-{
- string domain = error.domain.utf8();
- int code = error.reason;
-
- if (domain == net::kErrorDomain) {
- domain = "NSURLErrorDomain";
- switch (error.reason) {
- case net::ERR_ABORTED:
- code = -999;
- break;
- case net::ERR_UNSAFE_PORT:
- // Our unsafe port checking happens at the network stack level, but we
- // make this translation here to match the behavior of stock WebKit.
- domain = "WebKitErrorDomain";
- code = 103;
- break;
- case net::ERR_ADDRESS_INVALID:
- case net::ERR_ADDRESS_UNREACHABLE:
- code = -1004;
- break;
- }
- } else
- LOG_ERROR("Unknown error domain");
-
- printf("<NSError domain %s, code %d, failing URL \"%s\">",
- domain.c_str(), code, error.unreachableURL.spec().data());
-}
-
static void printNodeDescription(const WebNode& node, int exception)
{
if (exception) {
@@ -531,6 +501,11 @@ WebKit::WebGeolocationService* WebViewHost::geolocationService()
return m_geolocationServiceMock.get();
}
+WebSpeechInputController* WebViewHost::speechInputController(WebKit::WebSpeechInputListener* listener)
+{
+ return m_shell->layoutTestController()->speechInputController(listener);
+}
+
// WebWidgetClient -----------------------------------------------------------
void WebViewHost::didInvalidateRect(const WebRect& rect)
@@ -715,11 +690,7 @@ WebURLError WebViewHost::cannotHandleRequestError(WebFrame*, const WebURLRequest
WebURLError WebViewHost::cancelledError(WebFrame*, const WebURLRequest& request)
{
- WebURLError error;
- error.domain = WebString::fromUTF8(net::kErrorDomain);
- error.reason = net::ERR_ABORTED;
- error.unreachableURL = request.url();
- return error;
+ return webkit_support::CreateCancelledError(request);
}
void WebViewHost::unableToImplementPolicyWithError(WebFrame* frame, const WebURLError& error)
@@ -960,7 +931,7 @@ void WebViewHost::didFailResourceLoad(WebFrame*, unsigned identifier, const WebU
if (m_shell->shouldDumpResourceLoadCallbacks()) {
printResourceDescription(identifier);
fputs(" - didFailLoadingWithError: ", stdout);
- printErrorDescription(error);
+ fputs(webkit_support::MakeURLErrorDescription(error).c_str(), stdout);
fputs("\n", stdout);
}
m_resourceIdentifierMap.remove(identifier);
@@ -1081,7 +1052,7 @@ void WebViewHost::loadURLForFrame(const WebURL& url, const WebString& frameName)
if (!url.isValid())
return;
TestShell::resizeWindowForTest(this, url);
- navigationController()->loadEntry(new TestNavigationEntry(-1, url, WebString(), frameName));
+ navigationController()->loadEntry(TestNavigationEntry::create(-1, url, WebString(), frameName).get());
}
bool WebViewHost::navigate(const TestNavigationEntry& entry, bool reload)
@@ -1180,7 +1151,7 @@ void WebViewHost::updateURL(WebFrame* frame)
WebDataSource* ds = frame->dataSource();
ASSERT(ds);
const WebURLRequest& request = ds->request();
- OwnPtr<TestNavigationEntry> entry(new TestNavigationEntry);
+ RefPtr<TestNavigationEntry> entry(TestNavigationEntry::create());
// The referrer will be empty on https->http transitions. It
// would be nice if we could get the real referrer from somewhere.
@@ -1194,7 +1165,7 @@ void WebViewHost::updateURL(WebFrame* frame)
if (!historyItem.isNull())
entry->setContentState(historyItem);
- navigationController()->didNavigateToEntry(entry.leakPtr());
+ navigationController()->didNavigateToEntry(entry.get());
updateAddressBar(frame->view());
m_lastPageIdUpdated = max(m_lastPageIdUpdated, m_pageId);
}
@@ -1207,7 +1178,7 @@ void WebViewHost::updateSessionHistory(WebFrame* frame)
if (m_pageId == -1)
return;
- TestNavigationEntry* entry = static_cast<TestNavigationEntry*>(navigationController()->entryWithPageID(m_pageId));
+ TestNavigationEntry* entry = navigationController()->entryWithPageID(m_pageId);
if (!entry)
return;
diff --git a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
index 1e51be7..d95c59f 100644
--- a/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
+++ b/WebKitTools/DumpRenderTree/chromium/WebViewHost.h
@@ -46,6 +46,8 @@ class TestShell;
namespace WebKit {
class WebFrame;
class WebGeolocationServiceMock;
+class WebSpeechInputController;
+class WebSpeechInputListener;
class WebURL;
struct WebRect;
struct WebURLError;
@@ -83,8 +85,8 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
void loadURLForFrame(const WebKit::WebURL&, const WebKit::WebString& frameName);
TestNavigationController* navigationController() { return m_navigationController.get(); }
- void addClearHeader(const WebCore::String& header) { m_clearHeaders.add(header); }
- const HashSet<WebCore::String>& clearHeaders() const { return m_clearHeaders; }
+ void addClearHeader(const WTF::String& header) { m_clearHeaders.add(header); }
+ const HashSet<WTF::String>& clearHeaders() const { return m_clearHeaders; }
// NavigationHost
virtual bool navigate(const TestNavigationEntry&, bool reload);
@@ -126,6 +128,7 @@ class WebViewHost : public WebKit::WebViewClient, public WebKit::WebFrameClient,
virtual void focusAccessibilityObject(const WebKit::WebAccessibilityObject&);
virtual WebKit::WebNotificationPresenter* notificationPresenter();
virtual WebKit::WebGeolocationService* geolocationService();
+ virtual WebKit::WebSpeechInputController* speechInputController(WebKit::WebSpeechInputListener*);
// WebKit::WebWidgetClient
virtual void didInvalidateRect(const WebKit::WebRect&);
@@ -259,7 +262,7 @@ private:
bool m_selectTrailingWhitespaceEnabled;
// Set of headers to clear in willSendRequest.
- HashSet<WebCore::String> m_clearHeaders;
+ HashSet<WTF::String> m_clearHeaders;
// true if we should block any redirects
bool m_blocksRedirects;