| OLD | NEW |
| 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 "chrome/browser/extensions/api/web_request/web_request_permissions.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "chrome/common/extensions/extension_constants.h" | 8 #include "chrome/common/extensions/extension_constants.h" |
| 9 #include "chrome/common/extensions/extension_test_util.h" | 9 #include "chrome/common/extensions/extension_test_util.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 LoadManifestUnchecked("permissions", | 56 LoadManifestUnchecked("permissions", |
| 57 "web_request_com_host_permissions.json", | 57 "web_request_com_host_permissions.json", |
| 58 Manifest::INVALID_LOCATION, | 58 Manifest::INVALID_LOCATION, |
| 59 Extension::NO_FLAGS, | 59 Extension::NO_FLAGS, |
| 60 "ext_id_2", | 60 "ext_id_2", |
| 61 &error); | 61 &error); |
| 62 ASSERT_TRUE(com_extension_.get()) << error; | 62 ASSERT_TRUE(com_extension_.get()) << error; |
| 63 extension_info_map_ = new extensions::InfoMap; | 63 extension_info_map_ = new extensions::InfoMap; |
| 64 extension_info_map_->AddExtension(permissionless_extension_.get(), | 64 extension_info_map_->AddExtension(permissionless_extension_.get(), |
| 65 base::Time::Now(), | 65 base::Time::Now(), |
| 66 false /*incognito_enabled*/); | 66 false /*incognito_enabled*/, |
| 67 false /*notifications_disabled*/); |
| 67 extension_info_map_->AddExtension( | 68 extension_info_map_->AddExtension( |
| 68 com_extension_.get(), base::Time::Now(), false /*incognito_enabled*/); | 69 com_extension_.get(), |
| 70 base::Time::Now(), |
| 71 false /*incognito_enabled*/, |
| 72 false /*notifications_disabled*/); |
| 69 } | 73 } |
| 70 | 74 |
| 71 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) { | 75 TEST_F(ExtensionWebRequestHelpersTestWithThreadsTest, TestHideRequestForURL) { |
| 72 net::TestURLRequestContext context; | 76 net::TestURLRequestContext context; |
| 73 const char* sensitive_urls[] = { | 77 const char* sensitive_urls[] = { |
| 74 "http://clients2.google.com", | 78 "http://clients2.google.com", |
| 75 "http://clients22.google.com", | 79 "http://clients22.google.com", |
| 76 "https://clients2.google.com", | 80 "https://clients2.google.com", |
| 77 "http://clients2.google.com/service/update2/crx", | 81 "http://clients2.google.com/service/update2/crx", |
| 78 "https://clients.google.com", | 82 "https://clients.google.com", |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 request.url(), | 171 request.url(), |
| 168 false /*crosses_incognito*/, | 172 false /*crosses_incognito*/, |
| 169 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); | 173 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); |
| 170 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( | 174 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( |
| 171 extension_info_map_.get(), | 175 extension_info_map_.get(), |
| 172 com_extension_->id(), | 176 com_extension_->id(), |
| 173 request.url(), | 177 request.url(), |
| 174 false /*crosses_incognito*/, | 178 false /*crosses_incognito*/, |
| 175 WebRequestPermissions::REQUIRE_ALL_URLS)); | 179 WebRequestPermissions::REQUIRE_ALL_URLS)); |
| 176 } | 180 } |
| OLD | NEW |