Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1916)

Side by Side Diff: content/shell/browser/layout_test/layout_test_devtools_frontend.cc

Issue 870883008: Test runner: make inspector tests reuse a single inspector process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h" 5 #include "content/shell/browser/layout_test/layout_test_devtools_frontend.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 15 matching lines...) Expand all
26 NULL, 26 NULL,
27 gfx::Size()); 27 gfx::Size());
28 LayoutTestDevToolsFrontend* devtools_frontend = 28 LayoutTestDevToolsFrontend* devtools_frontend =
29 new LayoutTestDevToolsFrontend(shell, agent.get()); 29 new LayoutTestDevToolsFrontend(shell, agent.get());
30 30
31 shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); 31 shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url));
32 32
33 return devtools_frontend; 33 return devtools_frontend;
34 } 34 }
35 35
36 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend(
37 Shell* frontend_shell,
38 DevToolsAgentHost* agent_host)
39 : ShellDevToolsFrontend(frontend_shell, agent_host) {
40 }
41
42 LayoutTestDevToolsFrontend::~LayoutTestDevToolsFrontend() {
43 }
44
45 // static. 36 // static.
46 GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL( 37 GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL(
47 const std::string& settings, 38 const std::string& settings,
48 const std::string& frontend_url) { 39 const std::string& frontend_url) {
49 if (!frontend_url.empty()) 40 if (!frontend_url.empty())
50 return GURL(frontend_url); 41 return GURL(frontend_url);
51 base::FilePath dir_exe; 42 base::FilePath dir_exe;
52 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { 43 if (!PathService::Get(base::DIR_EXE, &dir_exe)) {
53 NOTREACHED(); 44 NOTREACHED();
54 return GURL(); 45 return GURL();
55 } 46 }
56 #if defined(OS_MACOSX) 47 #if defined(OS_MACOSX)
57 // On Mac, the executable is in 48 // On Mac, the executable is in
58 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. 49 // out/Release/Content Shell.app/Contents/MacOS/Content Shell.
59 // We need to go up 3 directories to get to out/Release. 50 // We need to go up 3 directories to get to out/Release.
60 dir_exe = dir_exe.AppendASCII("../../.."); 51 dir_exe = dir_exe.AppendASCII("../../..");
61 #endif 52 #endif
62 base::FilePath dev_tools_path = 53 base::FilePath dev_tools_path =
63 dir_exe.AppendASCII("resources/inspector/devtools.html"); 54 dir_exe.AppendASCII("resources/inspector/devtools.html");
64 55
65 GURL result = net::FilePathToFileURL(dev_tools_path); 56 GURL result = net::FilePathToFileURL(dev_tools_path);
66 if (!settings.empty()) 57 if (!settings.empty())
67 result = GURL(base::StringPrintf("%s?settings=%s&experiments=true", 58 result = GURL(base::StringPrintf("%s?settings=%s&experiments=true",
68 result.spec().c_str(), 59 result.spec().c_str(),
69 settings.c_str())); 60 settings.c_str()));
70 return result; 61 return result;
71 } 62 }
72 63
64 void LayoutTestDevToolsFrontend::ReuseFrontend(WebContents* inspected_contents,
65 const std::string& settings,
66 const std::string frontend_url) {
67 AttachTo(inspected_contents);
68 frontend_shell()->LoadURL(GetDevToolsPathAsURL(settings, frontend_url));
69 }
70
71 LayoutTestDevToolsFrontend::LayoutTestDevToolsFrontend(
72 Shell* frontend_shell,
73 DevToolsAgentHost* agent_host)
74 : ShellDevToolsFrontend(frontend_shell, agent_host) {
75 }
76
77 LayoutTestDevToolsFrontend::~LayoutTestDevToolsFrontend() {
78 }
79
80 void LayoutTestDevToolsFrontend::AgentHostClosed(
81 DevToolsAgentHost* agent_host, bool replaced) {
82 // Do not close the front-end shell.
83 }
84
73 void LayoutTestDevToolsFrontend::RenderProcessGone( 85 void LayoutTestDevToolsFrontend::RenderProcessGone(
74 base::TerminationStatus status) { 86 base::TerminationStatus status) {
75 WebKitTestController::Get()->DevToolsProcessCrashed(); 87 WebKitTestController::Get()->DevToolsProcessCrashed();
76 } 88 }
77 89
78 } // namespace content 90 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_devtools_frontend.h ('k') | content/shell/browser/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698