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

Side by Side Diff: components/test_runner/test_interfaces.cc

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: clean diff Created 4 years, 1 month 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 "components/test_runner/test_interfaces.h" 5 #include "components/test_runner/test_interfaces.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 test_runner_->ClearDevToolsLocalStorage(); 98 test_runner_->ClearDevToolsLocalStorage();
99 if (spec.find("/inspector/") != std::string::npos) { 99 if (spec.find("/inspector/") != std::string::npos) {
100 // Subfolder name determines default panel to open. 100 // Subfolder name determines default panel to open.
101 std::string test_path = spec.substr(spec.find("/inspector/") + 11); 101 std::string test_path = spec.substr(spec.find("/inspector/") + 11);
102 base::DictionaryValue settings; 102 base::DictionaryValue settings;
103 settings.SetString("testPath", base::GetQuotedJSONString(spec)); 103 settings.SetString("testPath", base::GetQuotedJSONString(spec));
104 std::string settings_string; 104 std::string settings_string;
105 base::JSONWriter::Write(settings, &settings_string); 105 base::JSONWriter::Write(settings, &settings_string);
106 test_runner_->ShowDevTools(settings_string, std::string()); 106 test_runner_->ShowDevTools(settings_string, std::string());
107 } 107 }
108 if (spec.find("/inspector-unit/") != std::string::npos &&
109 spec.find("spec.js") != std::string::npos) {
110 test_runner_->WaitUntilDone();
111 std::string inspector_unit_path = "/inspector-unit/";
112 std::string test_path = spec.substr(spec.find(inspector_unit_path) +
113 inspector_unit_path.length());
114 blink::WebURL test_shell_url = blink::WebURL(GURL(test_url).Resolve(
115 "/inspector-unit/resources/inspector-unit-test-shell.html?test=" +
116 test_path));
117 test_runner_->LoadURLForMainFrame(test_shell_url);
118 }
108 if (spec.find("/viewsource/") != std::string::npos) { 119 if (spec.find("/viewsource/") != std::string::npos) {
109 test_runner_->setShouldEnableViewSource(true); 120 test_runner_->setShouldEnableViewSource(true);
110 test_runner_->setShouldGeneratePixelResults(false); 121 test_runner_->setShouldGeneratePixelResults(false);
111 test_runner_->setShouldDumpAsMarkup(true); 122 test_runner_->setShouldDumpAsMarkup(true);
112 } 123 }
113 if (spec.find("/imported/wpt/") != std::string::npos || 124 if (spec.find("/imported/wpt/") != std::string::npos ||
114 spec.find("/imported/csswg-test/") != std::string::npos || 125 spec.find("/imported/csswg-test/") != std::string::npos ||
115 spec.find("://web-platform.test") != std::string::npos) 126 spec.find("://web-platform.test") != std::string::npos)
116 test_runner_->set_is_web_platform_tests_mode(); 127 test_runner_->set_is_web_platform_tests_mode();
117 } 128 }
(...skipping 29 matching lines...) Expand all
147 158
148 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() { 159 blink::WebThemeEngine* TestInterfaces::GetThemeEngine() {
149 if (!test_runner_->UseMockTheme()) 160 if (!test_runner_->UseMockTheme())
150 return 0; 161 return 0;
151 if (!theme_engine_.get()) 162 if (!theme_engine_.get())
152 theme_engine_.reset(new MockWebThemeEngine()); 163 theme_engine_.reset(new MockWebThemeEngine());
153 return theme_engine_.get(); 164 return theme_engine_.get();
154 } 165 }
155 166
156 } // namespace test_runner 167 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698