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

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

Issue 2448143004: DevTools: add custom-devtools-frontend flag for content shell layout tests (Closed)
Patch Set: nit Created 4 years, 1 month 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
« no previous file with comments | « no previous file | content/shell/common/layout_test/layout_test_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { 45 if (!PathService::Get(base::DIR_EXE, &dir_exe)) {
46 NOTREACHED(); 46 NOTREACHED();
47 return GURL(); 47 return GURL();
48 } 48 }
49 #if defined(OS_MACOSX) 49 #if defined(OS_MACOSX)
50 // On Mac, the executable is in 50 // On Mac, the executable is in
51 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. 51 // out/Release/Content Shell.app/Contents/MacOS/Content Shell.
52 // We need to go up 3 directories to get to out/Release. 52 // We need to go up 3 directories to get to out/Release.
53 dir_exe = dir_exe.AppendASCII("../../.."); 53 dir_exe = dir_exe.AppendASCII("../../..");
54 #endif 54 #endif
55 base::FilePath dev_tools_path;
55 bool is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch( 56 bool is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch(
56 switches::kDebugDevTools); 57 switches::kDebugDevTools);
57 std::string folder = is_debug_dev_tools ? "debug/" : ""; 58 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
58 base::FilePath dev_tools_path = 59 switches::kCustomDevToolsFrontend)) {
59 dir_exe.AppendASCII("resources/inspector/" + folder + "inspector.html"); 60 dev_tools_path = base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
61 switches::kCustomDevToolsFrontend);
62 } else {
63 std::string folder = is_debug_dev_tools ? "debug/" : "";
64 dev_tools_path = dir_exe.AppendASCII("resources/inspector/" + folder);
65 }
60 66
61 GURL result = net::FilePathToFileURL(dev_tools_path); 67 GURL result =
68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html"));
62 std::string url_string = 69 std::string url_string =
63 base::StringPrintf("%s?experiments=true", result.spec().c_str()); 70 base::StringPrintf("%s?experiments=true", result.spec().c_str());
64 if (is_debug_dev_tools) 71 if (is_debug_dev_tools)
65 url_string += "&debugFrontend=true"; 72 url_string += "&debugFrontend=true";
66 return GURL(url_string); 73 return GURL(url_string);
67 } 74 }
68 75
69 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, 76 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings,
70 const std::string frontend_url) { 77 const std::string frontend_url) {
71 DisconnectFromTarget(); 78 DisconnectFromTarget();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 base::TerminationStatus status) { 138 base::TerminationStatus status) {
132 BlinkTestController::Get()->DevToolsProcessCrashed(); 139 BlinkTestController::Get()->DevToolsProcessCrashed();
133 } 140 }
134 141
135 void LayoutTestDevToolsFrontend::RenderFrameCreated( 142 void LayoutTestDevToolsFrontend::RenderFrameCreated(
136 RenderFrameHost* render_frame_host) { 143 RenderFrameHost* render_frame_host) {
137 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); 144 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host);
138 } 145 }
139 146
140 } // namespace content 147 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/common/layout_test/layout_test_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698