| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "extensions/browser/api/web_request/web_request_permissions.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "url/gurl.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 TEST(ExtensionWebRequestPermissions, IsSensitiveURL) { |
| 13 struct TestCase { |
| 14 const char* url; |
| 15 bool is_sensitive; |
| 16 } cases[] = { |
| 17 {"http://www.google.com", false}, |
| 18 {"http://www.example.com", false}, |
| 19 {"http://clients.google.com", true}, |
| 20 {"http://clients4.google.com", true}, |
| 21 {"http://clients9999.google.com", true}, |
| 22 {"http://clients9999..google.com", false}, |
| 23 {"http://clients9999.example.google.com", false}, |
| 24 {"http://clients.google.com.", true}, |
| 25 {"http://.clients.google.com.", true}, |
| 26 {"http://google.example.com", false}, |
| 27 {"http://www.example.com", false}, |
| 28 {"http://clients.google.com", true}, |
| 29 {"http://sb-ssl.google.com", true}, |
| 30 {"http://sb-ssl.random.google.com", false}, |
| 31 {"http://chrome.google.com", false}, |
| 32 {"http://chrome.google.com/webstore", true}, |
| 33 {"http://chrome.google.com/webstore?query", true}, |
| 34 }; |
| 35 for (const TestCase& test : cases) { |
| 36 EXPECT_EQ(test.is_sensitive, IsSensitiveURL(GURL(test.url))) << test.url; |
| 37 } |
| 38 } |
| 39 |
| 40 } // namespace extensions |
| OLD | NEW |