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/declarative_webrequest/webrequest_rules_
registry.h" | 5 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_
registry.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 void WebRequestRulesRegistryTest::SetUp() { | 233 void WebRequestRulesRegistryTest::SetUp() { |
234 testing::Test::SetUp(); | 234 testing::Test::SetUp(); |
235 | 235 |
236 std::string error; | 236 std::string error; |
237 extension_ = LoadManifestUnchecked("permissions", | 237 extension_ = LoadManifestUnchecked("permissions", |
238 "web_request_all_host_permissions.json", | 238 "web_request_all_host_permissions.json", |
239 Manifest::INVALID_LOCATION, | 239 Manifest::INVALID_LOCATION, |
240 Extension::NO_FLAGS, | 240 Extension::NO_FLAGS, |
241 kExtensionId, | 241 kExtensionId, |
242 &error); | 242 &error); |
243 ASSERT_TRUE(extension_) << error; | 243 ASSERT_TRUE(extension_.get()) << error; |
244 extension2_ = | 244 extension2_ = LoadManifestUnchecked("permissions", |
245 LoadManifestUnchecked("permissions", | 245 "web_request_all_host_permissions.json", |
246 "web_request_all_host_permissions.json", | 246 Manifest::INVALID_LOCATION, |
247 Manifest::INVALID_LOCATION, | 247 Extension::NO_FLAGS, |
248 Extension::NO_FLAGS, | 248 kExtensionId2, |
249 kExtensionId2, | 249 &error); |
250 &error); | 250 ASSERT_TRUE(extension2_.get()) << error; |
251 ASSERT_TRUE(extension2_) << error; | |
252 extension_info_map_ = new ExtensionInfoMap; | 251 extension_info_map_ = new ExtensionInfoMap; |
253 ASSERT_TRUE(extension_info_map_); | 252 ASSERT_TRUE(extension_info_map_.get()); |
254 extension_info_map_->AddExtension(extension_.get(), | 253 extension_info_map_->AddExtension(extension_.get(), |
255 base::Time() + base::TimeDelta::FromDays(1), | 254 base::Time() + base::TimeDelta::FromDays(1), |
256 false /*incognito_enabled*/); | 255 false /*incognito_enabled*/); |
257 extension_info_map_->AddExtension(extension2_.get(), | 256 extension_info_map_->AddExtension(extension2_.get(), |
258 base::Time() + base::TimeDelta::FromDays(2), | 257 base::Time() + base::TimeDelta::FromDays(2), |
259 false /*incognito_enabled*/); | 258 false /*incognito_enabled*/); |
260 } | 259 } |
261 | 260 |
262 | 261 |
263 TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { | 262 TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 794 |
796 // This is a correct match. | 795 // This is a correct match. |
797 GURL url2("http://foo.com/index.html"); | 796 GURL url2("http://foo.com/index.html"); |
798 net::TestURLRequest request2(url2, NULL, &context, NULL); | 797 net::TestURLRequest request2(url2, NULL, &context, NULL); |
799 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); | 798 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); |
800 deltas = registry->CreateDeltas(NULL, request_data2, false); | 799 deltas = registry->CreateDeltas(NULL, request_data2, false); |
801 EXPECT_EQ(1u, deltas.size()); | 800 EXPECT_EQ(1u, deltas.size()); |
802 } | 801 } |
803 | 802 |
804 } // namespace extensions | 803 } // namespace extensions |
OLD | NEW |