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

Side by Side Diff: content/shell/renderer/test_runner/test_interfaces.cc

Issue 614023003: DevTools: pass the running test path into the devtools front-end. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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/renderer/test_runner/test_interfaces.h" 5 #include "content/shell/renderer/test_runner/test_interfaces.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 test_runner_->setShouldGeneratePixelResults(false); 111 test_runner_->setShouldGeneratePixelResults(false);
112 } 112 }
113 if (spec.find("/inspector/") != std::string::npos || 113 if (spec.find("/inspector/") != std::string::npos ||
114 spec.find("/inspector-enabled/") != std::string::npos) 114 spec.find("/inspector-enabled/") != std::string::npos)
115 test_runner_->ClearDevToolsLocalStorage(); 115 test_runner_->ClearDevToolsLocalStorage();
116 if (spec.find("/inspector/") != std::string::npos) { 116 if (spec.find("/inspector/") != std::string::npos) {
117 // Subfolder name determines default panel to open. 117 // Subfolder name determines default panel to open.
118 std::string settings = ""; 118 std::string settings = "";
119 std::string test_path = spec.substr(spec.find("/inspector/") + 11); 119 std::string test_path = spec.substr(spec.find("/inspector/") + 11);
120 size_t slash_index = test_path.find("/"); 120 size_t slash_index = test_path.find("/");
121 std::string test_path_setting = base::StringPrintf(
122 "\"testPath\":\"\\\"%s\\\"\"", spec.c_str());
123
124 // TODO(pfeldman): remove once migrated to testPath.
125 std::string last_active_panel;
121 if (slash_index != std::string::npos) { 126 if (slash_index != std::string::npos) {
122 settings = base::StringPrintf("{\"lastActivePanel\":\"\\\"%s\\\"\"}", 127 last_active_panel = base::StringPrintf(
123 test_path.substr(0, slash_index).c_str()); 128 ",\"lastActivePanel\":\"\\\"%s\\\"\"",
apavlov 2014/09/30 13:59:42 let's move this comma into the "{%s%s}" pattern be
129 test_path.substr(0, slash_index).c_str());
124 } 130 }
125 test_runner_->ShowDevTools(settings, std::string()); 131
132 test_runner_->ShowDevTools(base::StringPrintf("{%s%s}",
133 test_path_setting.c_str(), last_active_panel.c_str()), std::string());
126 } 134 }
127 if (spec.find("/viewsource/") != std::string::npos) { 135 if (spec.find("/viewsource/") != std::string::npos) {
128 test_runner_->setShouldEnableViewSource(true); 136 test_runner_->setShouldEnableViewSource(true);
129 test_runner_->setShouldGeneratePixelResults(false); 137 test_runner_->setShouldGeneratePixelResults(false);
130 test_runner_->setShouldDumpAsMarkup(true); 138 test_runner_->setShouldDumpAsMarkup(true);
131 } 139 }
132 } 140 }
133 141
134 void TestInterfaces::WindowOpened(WebTestProxyBase* proxy) { 142 void TestInterfaces::WindowOpened(WebTestProxyBase* proxy) {
135 window_list_.push_back(proxy); 143 window_list_.push_back(proxy);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (!theme_engine_.get()) 184 if (!theme_engine_.get())
177 theme_engine_.reset(new MockWebThemeEngineMac()); 185 theme_engine_.reset(new MockWebThemeEngineMac());
178 #else 186 #else
179 if (!theme_engine_.get()) 187 if (!theme_engine_.get())
180 theme_engine_.reset(new MockWebThemeEngine()); 188 theme_engine_.reset(new MockWebThemeEngine());
181 #endif 189 #endif
182 return theme_engine_.get(); 190 return theme_engine_.get();
183 } 191 }
184 192
185 } // namespace content 193 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698