| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/webui/devtools_ui.h" | 5 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 class DevToolsUITest : public testing::Test { | 8 class DevToolsUIBindingsTest : public testing::Test { |
| 9 }; | 9 }; |
| 10 | 10 |
| 11 TEST_F(DevToolsUITest, SanitizeFrontendURL) { | 11 TEST_F(DevToolsUIBindingsTest, SanitizeFrontendURL) { |
| 12 std::vector<std::pair<std::string, std::string>> tests = { | 12 std::vector<std::pair<std::string, std::string>> tests = { |
| 13 {"random-string", | 13 {"random-string", |
| 14 "chrome-devtools://devtools/"}, | 14 "chrome-devtools://devtools/"}, |
| 15 {"http://valid.url/but/wrong", | 15 {"http://valid.url/but/wrong", |
| 16 "chrome-devtools://devtools/but/wrong"}, | 16 "chrome-devtools://devtools/but/wrong"}, |
| 17 {"chrome-devtools://wrong-domain/", | 17 {"chrome-devtools://wrong-domain/", |
| 18 "chrome-devtools://devtools/"}, | 18 "chrome-devtools://devtools/"}, |
| 19 {"chrome-devtools://devtools/bundled/devtools.html", | 19 {"chrome-devtools://devtools/bundled/devtools.html", |
| 20 "chrome-devtools://devtools/bundled/devtools.html"}, | 20 "chrome-devtools://devtools/bundled/devtools.html"}, |
| 21 {"chrome-devtools://devtools:1234/bundled/devtools.html#hash", | 21 {"chrome-devtools://devtools:1234/bundled/devtools.html#hash", |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 "@12345/devtools.html%3Fws%3Danyvalue%26experiments%3Dlikely" | 89 "@12345/devtools.html%3Fws%3Danyvalue%26experiments%3Dlikely" |
| 90 "&unencoded=value&debugFrontend=true", | 90 "&unencoded=value&debugFrontend=true", |
| 91 "chrome-devtools://devtools/?experiments=true&remoteFrontendUrl=" | 91 "chrome-devtools://devtools/?experiments=true&remoteFrontendUrl=" |
| 92 "https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_rev" | 92 "https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_rev" |
| 93 "%2F%4012345%2Fdevtools.html%3Fws%3Danyvalue%26experiments%3Dtrue" | 93 "%2F%4012345%2Fdevtools.html%3Fws%3Danyvalue%26experiments%3Dtrue" |
| 94 "&debugFrontend=true"}, | 94 "&debugFrontend=true"}, |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 for (const auto& pair : tests) { | 97 for (const auto& pair : tests) { |
| 98 GURL url = GURL(pair.first); | 98 GURL url = GURL(pair.first); |
| 99 url = DevToolsUI::SanitizeFrontendURL(url); | 99 url = DevToolsUIBindings::SanitizeFrontendURL(url); |
| 100 EXPECT_EQ(pair.second, url.spec()); | 100 EXPECT_EQ(pair.second, url.spec()); |
| 101 } | 101 } |
| 102 } | 102 } |
| OLD | NEW |