summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authoryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 18:35:33 +0000
committeryurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-16 18:35:33 +0000
commit06c253014e6a751958cb9b2a60807e5431ecda72 (patch)
treec0201a85f48ad3cee4d5e483e702b87f204a0b22 /content
parent218d9d37d7b5c68c63c978dfe971385cc610f2ca (diff)
downloadchromium_src-06c253014e6a751958cb9b2a60807e5431ecda72.zip
chromium_src-06c253014e6a751958cb9b2a60807e5431ecda72.tar.gz
chromium_src-06c253014e6a751958cb9b2a60807e5431ecda72.tar.bz2
Allow passing frontend page url as an argument to testRunner.showWebInspector
We are going to use a simple page instead of full-fledged DevTools front-end to run DevTools protocol tests. The page URL will be passed as a param to showWebInspector. BUG=364013 Review URL: https://codereview.chromium.org/240133003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@264259 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/shell/browser/shell.cc15
-rw-r--r--content/shell/browser/shell.h6
-rw-r--r--content/shell/browser/shell_devtools_frontend.cc12
-rw-r--r--content/shell/browser/shell_devtools_frontend.h6
-rw-r--r--content/shell/browser/webkit_test_controller.cc7
-rw-r--r--content/shell/browser/webkit_test_controller.h3
-rw-r--r--content/shell/common/shell_messages.h5
-rw-r--r--content/shell/renderer/test_runner/TestInterfaces.cpp2
-rw-r--r--content/shell/renderer/test_runner/WebTestDelegate.h3
-rw-r--r--content/shell/renderer/test_runner/test_runner.cc18
-rw-r--r--content/shell/renderer/test_runner/test_runner.h6
-rw-r--r--content/shell/renderer/webkit_test_runner.cc6
-rw-r--r--content/shell/renderer/webkit_test_runner.h3
13 files changed, 58 insertions, 34 deletions
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index 027e611..e55fb85 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -228,16 +228,17 @@ void Shell::UpdateNavigationControls(bool to_different_document) {
}
void Shell::ShowDevTools() {
- InnerShowDevTools("");
+ InnerShowDevTools("", "");
}
void Shell::ShowDevToolsForElementAt(int x, int y) {
- InnerShowDevTools("");
+ InnerShowDevTools("", "");
devtools_frontend_->InspectElementAt(x, y);
}
-void Shell::ShowDevToolsForTest(const std::string& settings) {
- InnerShowDevTools(settings);
+void Shell::ShowDevToolsForTest(const std::string& settings,
+ const std::string& frontend_url) {
+ InnerShowDevTools(settings, frontend_url);
}
void Shell::CloseDevTools() {
@@ -377,9 +378,11 @@ void Shell::TitleWasSet(NavigationEntry* entry, bool explicit_set) {
PlatformSetTitle(entry->GetTitle());
}
-void Shell::InnerShowDevTools(const std::string& settings) {
+void Shell::InnerShowDevTools(const std::string& settings,
+ const std::string& frontend_url) {
if (!devtools_frontend_) {
- devtools_frontend_ = ShellDevToolsFrontend::Show(web_contents(), settings);
+ devtools_frontend_ = ShellDevToolsFrontend::Show(
+ web_contents(), settings, frontend_url);
devtools_observer_.reset(new DevToolsWebContentsObserver(
this, devtools_frontend_->frontend_shell()->web_contents()));
}
diff --git a/content/shell/browser/shell.h b/content/shell/browser/shell.h
index 48200df..2b0d59e 100644
--- a/content/shell/browser/shell.h
+++ b/content/shell/browser/shell.h
@@ -67,7 +67,8 @@ class Shell : public WebContentsDelegate,
void Close();
void ShowDevTools();
void ShowDevToolsForElementAt(int x, int y);
- void ShowDevToolsForTest(const std::string& settings);
+ void ShowDevToolsForTest(const std::string& settings,
+ const std::string& frontend_url);
void CloseDevTools();
#if defined(OS_MACOSX)
// Resizes the web content view to the given dimensions.
@@ -212,7 +213,8 @@ class Shell : public WebContentsDelegate,
// WebContentsObserver
virtual void TitleWasSet(NavigationEntry* entry, bool explicit_set) OVERRIDE;
- void InnerShowDevTools(const std::string& settings);
+ void InnerShowDevTools(const std::string& settings,
+ const std::string& frontend_url);
void OnDevToolsWebContentsDestroyed();
scoped_ptr<ShellJavaScriptDialogManager> dialog_manager_;
diff --git a/content/shell/browser/shell_devtools_frontend.cc b/content/shell/browser/shell_devtools_frontend.cc
index c33a25b..a25df91 100644
--- a/content/shell/browser/shell_devtools_frontend.cc
+++ b/content/shell/browser/shell_devtools_frontend.cc
@@ -26,7 +26,10 @@
namespace content {
// DevTools frontend path for inspector LayoutTests.
-GURL GetDevToolsPathAsURL(const std::string& settings) {
+GURL GetDevToolsPathAsURL(const std::string& settings,
+ const std::string& frontend_url) {
+ if (!frontend_url.empty())
+ return GURL(frontend_url);
base::FilePath dir_exe;
if (!PathService::Get(base::DIR_EXE, &dir_exe)) {
NOTREACHED();
@@ -52,13 +55,14 @@ GURL GetDevToolsPathAsURL(const std::string& settings) {
// static
ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
WebContents* inspected_contents) {
- return ShellDevToolsFrontend::Show(inspected_contents, "");
+ return ShellDevToolsFrontend::Show(inspected_contents, "", "");
}
// static
ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
WebContents* inspected_contents,
- const std::string& settings) {
+ const std::string& settings,
+ const std::string& frontend_url) {
scoped_refptr<DevToolsAgentHost> agent(
DevToolsAgentHost::GetOrCreateFor(
inspected_contents->GetRenderViewHost()));
@@ -74,7 +78,7 @@ ShellDevToolsFrontend* ShellDevToolsFrontend::Show(
ShellDevToolsDelegate* delegate = ShellContentBrowserClient::Get()->
shell_browser_main_parts()->devtools_delegate();
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
- shell->LoadURL(GetDevToolsPathAsURL(settings));
+ shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url));
else
shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL());
diff --git a/content/shell/browser/shell_devtools_frontend.h b/content/shell/browser/shell_devtools_frontend.h
index 62d0368..6244380 100644
--- a/content/shell/browser/shell_devtools_frontend.h
+++ b/content/shell/browser/shell_devtools_frontend.h
@@ -16,7 +16,8 @@
namespace content {
-GURL GetDevToolsPathAsURL(const std::string& settings);
+GURL GetDevToolsPathAsURL(const std::string& settings,
+ const std::string& frontend_url);
class RenderViewHost;
class Shell;
@@ -27,7 +28,8 @@ class ShellDevToolsFrontend : public WebContentsObserver,
public:
static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
static ShellDevToolsFrontend* Show(WebContents* inspected_contents,
- const std::string& settings);
+ const std::string& settings,
+ const std::string& frontend_url);
void Activate();
void Focus();
void InspectElementAt(int x, int y);
diff --git a/content/shell/browser/webkit_test_controller.cc b/content/shell/browser/webkit_test_controller.cc
index f63330b..d16986b 100644
--- a/content/shell/browser/webkit_test_controller.cc
+++ b/content/shell/browser/webkit_test_controller.cc
@@ -570,11 +570,12 @@ void WebKitTestController::OnClearDevToolsLocalStorage() {
StoragePartition* storage_partition =
BrowserContext::GetStoragePartition(browser_context, NULL);
storage_partition->GetDOMStorageContext()->DeleteLocalStorage(
- content::GetDevToolsPathAsURL("").GetOrigin());
+ content::GetDevToolsPathAsURL("", "").GetOrigin());
}
-void WebKitTestController::OnShowDevTools(const std::string& settings) {
- main_window_->ShowDevToolsForTest(settings);
+void WebKitTestController::OnShowDevTools(const std::string& settings,
+ const std::string& frontend_url) {
+ main_window_->ShowDevToolsForTest(settings, frontend_url);
}
void WebKitTestController::OnCloseDevTools() {
diff --git a/content/shell/browser/webkit_test_controller.h b/content/shell/browser/webkit_test_controller.h
index 47012ed..f9a7dbd 100644
--- a/content/shell/browser/webkit_test_controller.h
+++ b/content/shell/browser/webkit_test_controller.h
@@ -165,7 +165,8 @@ class WebKitTestController : public base::NonThreadSafe,
void OnOverridePreferences(const WebPreferences& prefs);
void OnTestFinished();
void OnClearDevToolsLocalStorage();
- void OnShowDevTools(const std::string& settings);
+ void OnShowDevTools(const std::string& settings,
+ const std::string& frontend_url);
void OnCloseDevTools();
void OnGoToOffset(int offset);
void OnReload();
diff --git a/content/shell/common/shell_messages.h b/content/shell/common/shell_messages.h
index 46e43ae..077099a 100644
--- a/content/shell/common/shell_messages.h
+++ b/content/shell/common/shell_messages.h
@@ -84,8 +84,9 @@ IPC_SYNC_MESSAGE_ROUTED1_1(ShellViewHostMsg_ReadFileToString,
IPC_MESSAGE_ROUTED1(ShellViewHostMsg_PrintMessage,
std::string /* message */)
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_ClearDevToolsLocalStorage)
-IPC_MESSAGE_ROUTED1(ShellViewHostMsg_ShowDevTools,
- std::string /* settings */)
+IPC_MESSAGE_ROUTED2(ShellViewHostMsg_ShowDevTools,
+ std::string /* settings */,
+ std::string /* frontend_url */)
IPC_MESSAGE_ROUTED0(ShellViewHostMsg_CloseDevTools)
IPC_MESSAGE_ROUTED1(ShellViewHostMsg_GoToOffset,
int /* offset */)
diff --git a/content/shell/renderer/test_runner/TestInterfaces.cpp b/content/shell/renderer/test_runner/TestInterfaces.cpp
index b2a1c0c..58d8e70 100644
--- a/content/shell/renderer/test_runner/TestInterfaces.cpp
+++ b/content/shell/renderer/test_runner/TestInterfaces.cpp
@@ -133,7 +133,7 @@ void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generat
"{\"lastActivePanel\":\"\\\"%s\\\"\"}",
test_path.substr(0, slash_index).c_str());
}
- m_testRunner->showDevTools(settings);
+ m_testRunner->showDevTools(settings, string());
}
if (spec.find("/viewsource/") != string::npos) {
m_testRunner->setShouldEnableViewSource(true);
diff --git a/content/shell/renderer/test_runner/WebTestDelegate.h b/content/shell/renderer/test_runner/WebTestDelegate.h
index 6c7b199..a3bc840 100644
--- a/content/shell/renderer/test_runner/WebTestDelegate.h
+++ b/content/shell/renderer/test_runner/WebTestDelegate.h
@@ -103,7 +103,8 @@ public:
virtual void clearDevToolsLocalStorage() = 0;
// Opens and closes the inspector.
- virtual void showDevTools(const std::string& settings) = 0;
+ virtual void showDevTools(const std::string& settings,
+ const std::string& frontend_url) = 0;
virtual void closeDevTools() = 0;
// Evaluate the given script in the DevTools agent.
diff --git a/content/shell/renderer/test_runner/test_runner.cc b/content/shell/renderer/test_runner/test_runner.cc
index 4e1ce4a..692b4d2 100644
--- a/content/shell/renderer/test_runner/test_runner.cc
+++ b/content/shell/renderer/test_runner/test_runner.cc
@@ -1104,9 +1104,11 @@ void TestRunnerBindings::SetUseMockTheme(bool use) {
void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) {
if (runner_) {
- std::string str;
- args->GetNext(&str);
- runner_->ShowWebInspector(str);
+ std::string settings;
+ args->GetNext(&settings);
+ std::string frontend_url;
+ args->GetNext(&frontend_url);
+ runner_->ShowWebInspector(settings, frontend_url);
}
}
@@ -1732,8 +1734,9 @@ void TestRunner::clearDevToolsLocalStorage() {
delegate_->clearDevToolsLocalStorage();
}
-void TestRunner::showDevTools(const std::string& settings) {
- delegate_->showDevTools(settings);
+void TestRunner::showDevTools(const std::string& settings,
+ const std::string& frontend_url) {
+ delegate_->showDevTools(settings, frontend_url);
}
class WorkItemBackForward : public TestRunner::WorkItem {
@@ -2463,8 +2466,9 @@ void TestRunner::SetUseMockTheme(bool use) {
use_mock_theme_ = use;
}
-void TestRunner::ShowWebInspector(const std::string& str) {
- showDevTools(str);
+void TestRunner::ShowWebInspector(const std::string& str,
+ const std::string& frontend_url) {
+ showDevTools(str, frontend_url);
}
void TestRunner::CloseWebInspector() {
diff --git a/content/shell/renderer/test_runner/test_runner.h b/content/shell/renderer/test_runner/test_runner.h
index d9388ef..9db752c 100644
--- a/content/shell/renderer/test_runner/test_runner.h
+++ b/content/shell/renderer/test_runner/test_runner.h
@@ -81,7 +81,8 @@ class TestRunner : public ::WebTestRunner::WebTestRunner,
bool shouldDumpAsMarkup();
bool shouldDumpChildFrameScrollPositions() const;
bool shouldDumpChildFramesAsText() const;
- void showDevTools(const std::string& settings);
+ void showDevTools(const std::string& settings,
+ const std::string& frontend_url);
void clearDevToolsLocalStorage();
void setShouldDumpAsText(bool);
void setShouldDumpAsMarkup(bool);
@@ -449,7 +450,8 @@ class TestRunner : public ::WebTestRunner::WebTestRunner,
// Methods forwarding to the WebTestDelegate
// Shows DevTools window.
- void ShowWebInspector(const std::string& str);
+ void ShowWebInspector(const std::string& str,
+ const std::string& frontend_url);
void CloseWebInspector();
// Inspect chooser state
diff --git a/content/shell/renderer/webkit_test_runner.cc b/content/shell/renderer/webkit_test_runner.cc
index 6253c58..806dfc6 100644
--- a/content/shell/renderer/webkit_test_runner.cc
+++ b/content/shell/renderer/webkit_test_runner.cc
@@ -406,8 +406,10 @@ void WebKitTestRunner::clearDevToolsLocalStorage() {
Send(new ShellViewHostMsg_ClearDevToolsLocalStorage(routing_id()));
}
-void WebKitTestRunner::showDevTools(const std::string& settings) {
- Send(new ShellViewHostMsg_ShowDevTools(routing_id(), settings));
+void WebKitTestRunner::showDevTools(const std::string& settings,
+ const std::string& frontend_url) {
+ Send(new ShellViewHostMsg_ShowDevTools(
+ routing_id(), settings, frontend_url));
}
void WebKitTestRunner::closeDevTools() {
diff --git a/content/shell/renderer/webkit_test_runner.h b/content/shell/renderer/webkit_test_runner.h
index df98718..4aea268 100644
--- a/content/shell/renderer/webkit_test_runner.h
+++ b/content/shell/renderer/webkit_test_runner.h
@@ -88,7 +88,8 @@ class WebKitTestRunner : public RenderViewObserver,
const blink::WebSize& max_size) OVERRIDE;
virtual void disableAutoResizeMode(const blink::WebSize& new_size) OVERRIDE;
virtual void clearDevToolsLocalStorage() OVERRIDE;
- virtual void showDevTools(const std::string& settings) OVERRIDE;
+ virtual void showDevTools(const std::string& settings,
+ const std::string& frontend_url) OVERRIDE;
virtual void closeDevTools() OVERRIDE;
virtual void evaluateInWebInspector(long call_id,
const std::string& script) OVERRIDE;