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

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

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: Moved type definition out of externs Created 4 years 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 GURL result = 67 GURL result =
68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html")); 68 net::FilePathToFileURL(dev_tools_path.AppendASCII("inspector.html"));
69 std::string url_string = 69 std::string url_string =
70 base::StringPrintf("%s?experiments=true", result.spec().c_str()); 70 base::StringPrintf("%s?experiments=true", result.spec().c_str());
71 if (is_debug_dev_tools) 71 if (is_debug_dev_tools)
72 url_string += "&debugFrontend=true"; 72 url_string += "&debugFrontend=true";
73 return GURL(url_string); 73 return GURL(url_string);
74 } 74 }
75 75
76 // static.
77 GURL LayoutTestDevToolsFrontend::MapJSTestURL(const GURL& test_url) {
78 std::string url_string = GetDevToolsPathAsURL(std::string()).spec();
79 std::string inspector_file_name = "inspector.html";
80 size_t start_position = url_string.find(inspector_file_name);
81 url_string.replace(start_position, inspector_file_name.length(),
82 "unit_test_runner.html");
83 url_string += "&test=" + test_url.spec();
84 return GURL(url_string);
85 }
86
76 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings, 87 void LayoutTestDevToolsFrontend::ReuseFrontend(const std::string& settings,
77 const std::string frontend_url) { 88 const std::string frontend_url) {
78 DisconnectFromTarget(); 89 DisconnectFromTarget();
79 SetPreferences(settings); 90 SetPreferences(settings);
80 ready_for_test_ = false; 91 ready_for_test_ = false;
81 pending_evaluations_.clear(); 92 pending_evaluations_.clear();
82 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url)); 93 frontend_shell()->LoadURL(GetDevToolsPathAsURL(frontend_url));
83 } 94 }
84 95
85 void LayoutTestDevToolsFrontend::EvaluateInFrontend( 96 void LayoutTestDevToolsFrontend::EvaluateInFrontend(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 base::TerminationStatus status) { 149 base::TerminationStatus status) {
139 BlinkTestController::Get()->DevToolsProcessCrashed(); 150 BlinkTestController::Get()->DevToolsProcessCrashed();
140 } 151 }
141 152
142 void LayoutTestDevToolsFrontend::RenderFrameCreated( 153 void LayoutTestDevToolsFrontend::RenderFrameCreated(
143 RenderFrameHost* render_frame_host) { 154 RenderFrameHost* render_frame_host) {
144 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host); 155 BlinkTestController::Get()->HandleNewRenderFrameHost(render_frame_host);
145 } 156 }
146 157
147 } // namespace content 158 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698