diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-25 09:53:55 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-25 09:53:55 +0000 |
commit | 926df35f81c115925b3323ff7532be360bf87486 (patch) | |
tree | 39d9f613f5501850f94d3c47f23f65cec5c3a2cb /content/shell | |
parent | 89f0fa2d607d4b70d6cd31d996ddf721523fedd1 (diff) | |
download | chromium_src-926df35f81c115925b3323ff7532be360bf87486.zip chromium_src-926df35f81c115925b3323ff7532be360bf87486.tar.gz chromium_src-926df35f81c115925b3323ff7532be360bf87486.tar.bz2 |
[content shell] launch devtools from a file: url during layout tests
BUG=111316
R=pfeldman@chromium.org
TEST=inspector/extensions tests pass
Review URL: https://chromiumcodereview.appspot.com/12316089
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r-- | content/shell/shell_devtools_frontend.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/content/shell/shell_devtools_frontend.cc b/content/shell/shell_devtools_frontend.cc index cd07421..d6aaeeb 100644 --- a/content/shell/shell_devtools_frontend.cc +++ b/content/shell/shell_devtools_frontend.cc @@ -4,6 +4,8 @@ #include "content/shell/shell_devtools_frontend.h" +#include "base/command_line.h" +#include "base/path_service.h" #include "content/public/browser/devtools_http_handler.h" #include "content/public/browser/devtools_manager.h" #include "content/public/browser/web_contents.h" @@ -13,9 +15,30 @@ #include "content/shell/shell_browser_main_parts.h" #include "content/shell/shell_content_browser_client.h" #include "content/shell/shell_devtools_delegate.h" +#include "content/shell/shell_switches.h" +#include "net/base/net_util.h" namespace content { +namespace { + +// DevTools frontend path for inspector LayoutTests. +GURL GetDevToolsPathAsURL() { + base::FilePath dir_exe; + if (!PathService::Get(base::DIR_EXE, &dir_exe)) { + NOTREACHED(); + return GURL(); + } +#if defined(OS_MACOSX) + dir_exe = dir_exe.AppendASCII("../../.."); +#endif + base::FilePath dev_tools_path = dir_exe.AppendASCII( + "resources/inspector/devtools.html"); + return net::FilePathToFileURL(dev_tools_path); +} + +} // namespace + // static ShellDevToolsFrontend* ShellDevToolsFrontend::Show( WebContents* inspected_contents) { @@ -33,7 +56,10 @@ ShellDevToolsFrontend* ShellDevToolsFrontend::Show( GetContentClient()->browser()); ShellDevToolsDelegate* delegate = browser_client->shell_browser_main_parts()->devtools_delegate(); - shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL(NULL)); + if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) + shell->LoadURL(GetDevToolsPathAsURL()); + else + shell->LoadURL(delegate->devtools_http_handler()->GetFrontendURL(NULL)); return devtools_frontend; } |