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

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

Issue 2177983004: [DevTools] Do not use "settings" query param. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 5 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"
(...skipping 12 matching lines...) Expand all
23 LayoutTestDevToolsFrontend* LayoutTestDevToolsFrontend::Show( 23 LayoutTestDevToolsFrontend* LayoutTestDevToolsFrontend::Show(
24 WebContents* inspected_contents, 24 WebContents* inspected_contents,
25 const std::string& settings, 25 const std::string& settings,
26 const std::string& frontend_url) { 26 const std::string& frontend_url) {
27 Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(), 27 Shell* shell = Shell::CreateNewWindow(inspected_contents->GetBrowserContext(),
28 GURL(), 28 GURL(),
29 NULL, 29 NULL,
30 gfx::Size()); 30 gfx::Size());
31 LayoutTestDevToolsFrontend* devtools_frontend = 31 LayoutTestDevToolsFrontend* devtools_frontend =
32 new LayoutTestDevToolsFrontend(shell, inspected_contents); 32 new LayoutTestDevToolsFrontend(shell, inspected_contents);
33 33 devtools_frontend->SetPreferences(settings);
34 shell->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); 34 shell->LoadURL(GetDevToolsPathAsURL(frontend_url));
35
36 return devtools_frontend; 35 return devtools_frontend;
37 } 36 }
38 37
39 // static. 38 // static.
40 GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL( 39 GURL LayoutTestDevToolsFrontend::GetDevToolsPathAsURL(
41 const std::string& settings,
42 const std::string& frontend_url) { 40 const std::string& frontend_url) {
43 if (!frontend_url.empty()) 41 if (!frontend_url.empty())
44 return GURL(frontend_url); 42 return GURL(frontend_url);
45 base::FilePath dir_exe; 43 base::FilePath dir_exe;
46 if (!PathService::Get(base::DIR_EXE, &dir_exe)) { 44 if (!PathService::Get(base::DIR_EXE, &dir_exe)) {
47 NOTREACHED(); 45 NOTREACHED();
48 return GURL(); 46 return GURL();
49 } 47 }
50 #if defined(OS_MACOSX) 48 #if defined(OS_MACOSX)
51 // On Mac, the executable is in 49 // On Mac, the executable is in
52 // out/Release/Content Shell.app/Contents/MacOS/Content Shell. 50 // out/Release/Content Shell.app/Contents/MacOS/Content Shell.
53 // We need to go up 3 directories to get to out/Release. 51 // We need to go up 3 directories to get to out/Release.
54 dir_exe = dir_exe.AppendASCII("../../.."); 52 dir_exe = dir_exe.AppendASCII("../../..");
55 #endif 53 #endif
56 base::FilePath dev_tools_path = 54 base::FilePath dev_tools_path =
57 dir_exe.AppendASCII("resources/inspector/inspector.html"); 55 dir_exe.AppendASCII("resources/inspector/inspector.html");
58 56
59 GURL result = net::FilePathToFileURL(dev_tools_path); 57 GURL result = net::FilePathToFileURL(dev_tools_path);
60 std::string url_string = 58 std::string url_string =
61 base::StringPrintf("%s?experiments=true", result.spec().c_str()); 59 base::StringPrintf("%s?experiments=true", result.spec().c_str());
62 #if defined(DEBUG_DEVTOOLS) 60 #if defined(DEBUG_DEVTOOLS)
63 url_string += "&debugFrontend=true"; 61 url_string += "&debugFrontend=true";
64 #endif // defined(DEBUG_DEVTOOLS) 62 #endif // defined(DEBUG_DEVTOOLS)
65 if (!settings.empty())
66 url_string += "&settings=" + settings;
67 return GURL(url_string); 63 return GURL(url_string);
68 } 64 }
69 65
70 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, 66 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings,
71 const std::string frontend_url) { 67 const std::string frontend_url) {
72 DisconnectFromTarget(); 68 DisconnectFromTarget();
73 preferences()->Clear(); 69 SetPreferences(settings);
74 ready_for_test_ = false; 70 ready_for_test_ = false;
75 pending_evaluations_.clear(); 71 pending_evaluations_.clear();
76 frontend_shell()->LoadURL(GetDevToolsPathAsURL(settings, frontend_url)); 72 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url));
77 } 73 }
78 74
79 void LayoutTestDevToolsFrontend::EvaluateInFrontend( 75 void LayoutTestDevToolsFrontend::EvaluateInFrontend(
80 int call_id, 76 int call_id,
81 const std::string& script) { 77 const std::string& script) {
82 if (!ready_for_test_) { 78 if (!ready_for_test_) {
83 pending_evaluations_.push_back(std::make_pair(call_id, script)); 79 pending_evaluations_.push_back(std::make_pair(call_id, script));
84 return; 80 return;
85 } 81 }
86 82
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::TerminationStatus status) { 128 base::TerminationStatus status) {
133 BlinkTestController::Get()->DevToolsProcessCrashed(); 129 BlinkTestController::Get()->DevToolsProcessCrashed();
134 } 130 }
135 131
136 void LayoutTestDevToolsFrontend::RenderFrameCreated( 132 void LayoutTestDevToolsFrontend::RenderFrameCreated(
137 RenderFrameHost* render_frame_host) { 133 RenderFrameHost* render_frame_host) {
138 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); 134 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host);
139 } 135 }
140 136
141 } // namespace content 137 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/browser/layout_test/layout_test_devtools_frontend.h ('k') | content/shell/browser/shell_devtools_frontend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698