Commit c02c2014 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[devtools] load remote devtools frontend for non-hosted mode

R=bmeurer@chromium.org

Fixed: 1095988
Change-Id: I6ebbe3de665d308d0a30ede1c6c27e5745f484e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2248626Reviewed-by: default avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Auto-Submit: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780432}
parent 424526a0
......@@ -115,13 +115,20 @@ void DevToolsDataSource::StartDataRequest(
base::CompareCase::INSENSITIVE_ASCII));
std::string path_under_bundled =
path_without_params.substr(bundled_path_prefix.length());
GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL();
if (!custom_devtools_frontend.is_valid()) {
// Fetch from packaged resources.
StartBundledDataRequest(path_under_bundled, std::move(callback));
return;
}
if (GetCustomDevToolsFrontendURL().SchemeIsFile()) {
// Fetch from file system.
StartFileRequest(path_under_bundled, std::move(callback));
} else {
// Fetch from packaged resources.
StartBundledDataRequest(path_under_bundled, std::move(callback));
return;
}
GURL remote_url(custom_devtools_frontend.spec() + path_under_bundled);
// Fetch from remote URL.
StartCustomDataRequest(remote_url, std::move(callback));
return;
}
......
......@@ -128,7 +128,7 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledURLWithQueryParam) {
EXPECT_FALSE(data().empty());
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledURLWithSwitch) {
TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledFileURLWithSwitch) {
#if defined(OS_WIN)
const char* flag_value = "file://C:/tmp/";
#else
......@@ -143,6 +143,17 @@ TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledURLWithSwitch) {
EXPECT_EQ(data(), "file: devtools_app.html");
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsBundledRemoteURLWithSwitch) {
const char* flag_value = "http://example.com/example/path/";
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kCustomDevtoolsFrontend, flag_value);
const GURL path =
DevToolsUrl().Resolve(DevToolsBundledPath(kDevToolsUITestFrontEndUrl));
StartRequest(path.path());
EXPECT_TRUE(data_received());
EXPECT_EQ(data(), "url: http://example.com/example/path/devtools_app.html");
}
TEST_F(DevToolsUIDataSourceTest, TestDevToolsInvalidBundledURL) {
const GURL path =
DevToolsUrl().Resolve(DevToolsBundledPath("invalid_devtools_app.html"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment