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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc

Issue 635573005: Cleanup: Better constify some strings in chrome/browser/{chromeos,extensions}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, nit Created 6 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "extensions/browser/api/web_request/web_request_permissions.h" 5 #include "extensions/browser/api/web_request/web_request_permissions.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "chrome/common/extensions/extension_test_util.h" 9 #include "chrome/common/extensions/extension_test_util.h"
10 #include "content/public/browser/resource_request_info.h" 10 #include "content/public/browser/resource_request_info.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 false /*notifications_disabled*/); 70 false /*notifications_disabled*/);
71 extension_info_map_->AddExtension( 71 extension_info_map_->AddExtension(
72 com_extension_.get(), 72 com_extension_.get(),
73 base::Time::Now(), 73 base::Time::Now(),
74 false /*incognito_enabled*/, 74 false /*incognito_enabled*/,
75 false /*notifications_disabled*/); 75 false /*notifications_disabled*/);
76 } 76 }
77 77
78 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) { 78 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) {
79 net::TestURLRequestContext context; 79 net::TestURLRequestContext context;
80 const char* sensitive_urls[] = { 80 const char* const sensitive_urls[] = {
81 "http://clients2.google.com", 81 "http://clients2.google.com",
82 "http://clients22.google.com", 82 "http://clients22.google.com",
83 "https://clients2.google.com", 83 "https://clients2.google.com",
84 "http://clients2.google.com/service/update2/crx", 84 "http://clients2.google.com/service/update2/crx",
85 "https://clients.google.com", 85 "https://clients.google.com",
86 "https://test.clients.google.com", 86 "https://test.clients.google.com",
87 "https://clients2.google.com/service/update2/crx", 87 "https://clients2.google.com/service/update2/crx",
88 "http://www.gstatic.com/chrome/extensions/blacklist", 88 "http://www.gstatic.com/chrome/extensions/blacklist",
89 "https://www.gstatic.com/chrome/extensions/blacklist", 89 "https://www.gstatic.com/chrome/extensions/blacklist",
90 "notregisteredscheme://www.foobar.com", 90 "notregisteredscheme://www.foobar.com",
91 "https://chrome.google.com/webstore/", 91 "https://chrome.google.com/webstore/",
92 "https://chrome.google.com/webstore/" 92 "https://chrome.google.com/webstore/"
93 "inlineinstall/detail/kcnhkahnjcbndmmehfkdnkjomaanaooo" 93 "inlineinstall/detail/kcnhkahnjcbndmmehfkdnkjomaanaooo"
94 }; 94 };
95 const char* non_sensitive_urls[] = { 95 const char* const non_sensitive_urls[] = {
96 "http://www.google.com/" 96 "http://www.google.com/"
97 }; 97 };
98 const int kSigninProcessId = 99; 98 const int kSigninProcessId = 99;
99 extension_info_map_->SetSigninProcess(kSigninProcessId); 99 extension_info_map_->SetSigninProcess(kSigninProcessId);
100 100
101 // Check that requests are rejected based on the destination 101 // Check that requests are rejected based on the destination
102 for (size_t i = 0; i < arraysize(sensitive_urls); ++i) { 102 for (size_t i = 0; i < arraysize(sensitive_urls); ++i) {
103 GURL sensitive_url(sensitive_urls[i]); 103 GURL sensitive_url(sensitive_urls[i]);
104 scoped_ptr<net::URLRequest> request(context.CreateRequest( 104 scoped_ptr<net::URLRequest> request(context.CreateRequest(
105 sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL)); 105 sensitive_url, net::DEFAULT_PRIORITY, NULL, NULL));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 request->url(), 183 request->url(),
184 false /*crosses_incognito*/, 184 false /*crosses_incognito*/,
185 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); 185 WebRequestPermissions::REQUIRE_HOST_PERMISSION));
186 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( 186 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL(
187 extension_info_map_.get(), 187 extension_info_map_.get(),
188 com_extension_->id(), 188 com_extension_->id(),
189 request->url(), 189 request->url(),
190 false /*crosses_incognito*/, 190 false /*crosses_incognito*/,
191 WebRequestPermissions::REQUIRE_ALL_URLS)); 191 WebRequestPermissions::REQUIRE_ALL_URLS));
192 } 192 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_unittest.cc ('k') | chrome/browser/extensions/chrome_app_sorting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698