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

Unified Diff: content/shell/browser/layout_test/layout_test_devtools_bindings.cc

Issue 2837083003: DevTools: create test infrastructure so devtools drives the test (Closed)
Patch Set: all Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/shell/browser/layout_test/layout_test_devtools_bindings.cc
diff --git a/content/shell/browser/layout_test/layout_test_devtools_bindings.cc b/content/shell/browser/layout_test/layout_test_devtools_bindings.cc
index 529e1f99f6e241e706ad27ba35435694a1cc132b..10dbc37fbc4d6bfcf43990b37f8c05fc49e724d1 100644
--- a/content/shell/browser/layout_test/layout_test_devtools_bindings.cc
+++ b/content/shell/browser/layout_test/layout_test_devtools_bindings.cc
@@ -58,12 +58,31 @@ GURL LayoutTestDevToolsBindings::GetDevToolsPathAsURL(
}
// static.
-GURL LayoutTestDevToolsBindings::MapJSTestURL(const GURL& test_url) {
+GURL LayoutTestDevToolsBindings::MapTestURLIfNeeded(const GURL& test_url,
+ bool* is_integration_test) {
+ std::string spec = test_url.spec();
+ *is_integration_test = spec.find("/devtools-js/") != std::string::npos;
+ bool is_unit_test = spec.find("/inspector-unit/") != std::string::npos;
+ if (!*is_integration_test && !is_unit_test) {
dgozman 2017/06/19 22:55:51 nit: no need for {}
chenwilliam 2017/06/19 23:48:17 Done.
+ return test_url;
+ }
+ std::string test_page;
+ if (is_integration_test)
dgozman 2017/06/19 22:55:51 *is_integration_test
chenwilliam 2017/06/19 23:48:17 Done. Ah, so it was running the unit tests as inte
+ test_page = "integration_test_runner.html";
+ else
+ test_page = "unit_test_runner.html";
+ return MapJSTestURL(test_url, test_page);
dgozman 2017/06/19 22:55:51 MapJSTestURL(test_url, is_unit_test ? "unit_test_r
chenwilliam 2017/06/19 23:48:17 Done.
+}
+
+// static.
+GURL LayoutTestDevToolsBindings::MapJSTestURL(
+ const GURL& test_url,
+ const std::string& entry_filename) {
std::string url_string = GetDevToolsPathAsURL(std::string()).spec();
std::string inspector_file_name = "inspector.html";
size_t start_position = url_string.find(inspector_file_name);
url_string.replace(start_position, inspector_file_name.length(),
- "unit_test_runner.html");
+ entry_filename);
url_string += "&test=" + test_url.spec();
return GURL(url_string);
}
@@ -84,7 +103,6 @@ LayoutTestDevToolsBindings* LayoutTestDevToolsBindings::LoadDevTools(
ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
bindings->web_contents()->GetController().LoadURLWithParams(params);
bindings->web_contents()->Focus();
- bindings->CreateFrontendHost();
return bindings;
}

Powered by Google App Engine
This is Rietveld 408576698