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

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

Issue 2262743002: DevTools: Run devtools tests in release mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add flag Created 4 years, 4 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/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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "content/public/browser/render_frame_host.h" 14 #include "content/public/browser/render_frame_host.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/shell/browser/layout_test/blink_test_controller.h" 16 #include "content/shell/browser/layout_test/blink_test_controller.h"
17 #include "content/shell/browser/shell.h" 17 #include "content/shell/browser/shell.h"
18 #include "content/shell/common/layout_test/layout_test_switches.h"
18 #include "net/base/filename_util.h" 19 #include "net/base/filename_util.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 // static 23 // static
23 LayoutTestDevToolsFrontend* LayoutTestDevToolsFrontend::Show( 24 LayoutTestDevToolsFrontend* LayoutTestDevToolsFrontend::Show(
24 WebContents* inspected_contents, 25 WebContents* inspected_contents,
25 const std::string& settings, 26 const std::string& settings,
26 const std::string& frontend_url) { 27 const std::string& frontend_url) {
27 Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(), 28 Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(),
(...skipping 16 matching lines...) Expand all
44 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { 45 if (!PathService::Get(base::DIR_EXE, &dir_exe)) {
45 NOTREACHED(); 46 NOTREACHED();
46 return GURL(); 47 return GURL();
47 } 48 }
48 #if defined(OS_MACOSX) 49 #if defined(OS_MACOSX)
49 // On Mac, the executable is in 50 // On Mac, the executable is in
50 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. 51 // out/Release/Content Shell.app/Contents/MacOS/Content Shell.
51 // 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.
52 dir_exe = dir_exe.AppendASCII("../../.."); 53 dir_exe = dir_exe.AppendASCII("../../..");
53 #endif 54 #endif
55 bool isDebugDevTools = base::CommandLine::ForCurrentProcess()->HasSwitch(
pfeldman 2016/08/24 00:36:04 use_underscore_notation
chenwilliam 2016/08/24 22:53:40 Done.
56 switches::kDebugDevTools);
57 std::string folder = isDebugDevTools ? "inspector" : "inspector_release";
54 base::FilePath dev_tools_path = 58 base::FilePath dev_tools_path =
55 dir_exe.AppendASCII("resources/inspector/inspector.html"); 59 dir_exe.AppendASCII("resources/" + folder + "/inspector.html");
56 60
57 GURL result = net::FilePathToFileURL(dev_tools_path); 61 GURL result = net::FilePathToFileURL(dev_tools_path);
58 std::string url_string = 62 std::string url_string =
59 base::StringPrintf("%s?experiments=true", result.spec().c_str()); 63 base::StringPrintf("%s?experiments=true", result.spec().c_str());
60 #if defined(DEBUG_DEVTOOLS) 64 #if defined(DEBUG_DEVTOOLS)
pfeldman 2016/08/24 00:36:04 This should now be based on the runtime check.
chenwilliam 2016/08/24 22:53:40 Done.
61 url_string += "&debugFrontend=true"; 65 url_string += "&debugFrontend=true";
62 #endif // defined(DEBUG_DEVTOOLS) 66 #endif // defined(DEBUG_DEVTOOLS)
63 return GURL(url_string); 67 return GURL(url_string);
64 } 68 }
65 69
66 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, 70 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings,
67 const std::string frontend_url) { 71 const std::string frontend_url) {
68 DisconnectFromTarget(); 72 DisconnectFromTarget();
69 SetPreferences(settings); 73 SetPreferences(settings);
70 ready_for_test_ = false; 74 ready_for_test_ = false;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::TerminationStatus status) { 132 base::TerminationStatus status) {
129 BlinkTestController::Get()->DevToolsProcessCrashed(); 133 BlinkTestController::Get()->DevToolsProcessCrashed();
130 } 134 }
131 135
132 void LayoutTestDevToolsFrontend::RenderFrameCreated( 136 void LayoutTestDevToolsFrontend::RenderFrameCreated(
133 RenderFrameHost* render_frame_host) { 137 RenderFrameHost* render_frame_host) {
134 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); 138 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host);
135 } 139 }
136 140
137 } // namespace content 141 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/common/layout_test/layout_test_switches.h » ('j') | third_party/WebKit/Source/devtools/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698