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

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: Pull from master Created 4 years, 3 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 is_debug_dev_tools = base::CommandLine::ForCurrentProcess()->HasSwitch(
56 switches::kDebugDevTools);
57 std::string folder = is_debug_dev_tools ? "debug/" : "";
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/inspector/" + 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 (is_debug_dev_tools)
61 url_string += "&debugFrontend=true"; 65 url_string += "&debugFrontend=true";
62 #endif // defined(DEBUG_DEVTOOLS)
63 return GURL(url_string); 66 return GURL(url_string);
64 } 67 }
65 68
66 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, 69 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings,
67 const std::string frontend_url) { 70 const std::string frontend_url) {
68 DisconnectFromTarget(); 71 DisconnectFromTarget();
69 SetPreferences(settings); 72 SetPreferences(settings);
70 ready_for_test_ = false; 73 ready_for_test_ = false;
71 pending_evaluations_.clear(); 74 pending_evaluations_.clear();
72 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url)); 75 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::TerminationStatus status) { 131 base::TerminationStatus status) {
129 BlinkTestController::Get()->DevToolsProcessCrashed(); 132 BlinkTestController::Get()->DevToolsProcessCrashed();
130 } 133 }
131 134
132 void LayoutTestDevToolsFrontend::RenderFrameCreated( 135 void LayoutTestDevToolsFrontend::RenderFrameCreated(
133 RenderFrameHost* render_frame_host) { 136 RenderFrameHost* render_frame_host) {
134 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); 137 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host);
135 } 138 }
136 139
137 } // namespace content 140 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.cc ('k') | content/shell/common/layout_test/layout_test_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698