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

Unified Diff: extensions/browser/api/web_request/web_request_permissions_unittest.cc

Issue 2489233003: [extensions] Remove unnecessary checks in IsSensitiveURL (Closed)
Patch Set: more DomainIs 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/api/web_request/web_request_permissions.cc ('k') | extensions/common/extension_urls.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/web_request/web_request_permissions_unittest.cc
diff --git a/extensions/browser/api/web_request/web_request_permissions_unittest.cc b/extensions/browser/api/web_request/web_request_permissions_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d8b212d17ff48adcd410c5ceb408467133032d5d
--- /dev/null
+++ b/extensions/browser/api/web_request/web_request_permissions_unittest.cc
@@ -0,0 +1,40 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "extensions/browser/api/web_request/web_request_permissions.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "url/gurl.h"
+
+namespace extensions {
+
+TEST(ExtensionWebRequestPermissions, IsSensitiveURL) {
+ struct TestCase {
+ const char* url;
+ bool is_sensitive;
+ } cases[] = {
+ {"http://www.google.com", false},
+ {"http://www.example.com", false},
+ {"http://clients.google.com", true},
+ {"http://clients4.google.com", true},
+ {"http://clients9999.google.com", true},
+ {"http://clients9999..google.com", false},
+ {"http://clients9999.example.google.com", false},
+ {"http://clients.google.com.", true},
+ {"http://.clients.google.com.", true},
+ {"http://google.example.com", false},
+ {"http://www.example.com", false},
+ {"http://clients.google.com", true},
+ {"http://sb-ssl.google.com", true},
+ {"http://sb-ssl.random.google.com", false},
+ {"http://chrome.google.com", false},
+ {"http://chrome.google.com/webstore", true},
+ {"http://chrome.google.com/webstore?query", true},
+ };
+ for (const TestCase& test : cases) {
+ EXPECT_EQ(test.is_sensitive, IsSensitiveURL(GURL(test.url))) << test.url;
+ }
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/browser/api/web_request/web_request_permissions.cc ('k') | extensions/common/extension_urls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698