| 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 "extensions/browser/api/declarative_webrequest/webrequest_rules_registr
y.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_rules_registr
y.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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // How many rules are there which have some conditions not triggered by URL | 66 // How many rules are there which have some conditions not triggered by URL |
| 67 // matches. | 67 // matches. |
| 68 size_t RulesWithoutTriggers() const { | 68 size_t RulesWithoutTriggers() const { |
| 69 return rules_with_untriggered_conditions_for_test().size(); | 69 return rules_with_untriggered_conditions_for_test().size(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 protected: | 72 protected: |
| 73 virtual ~TestWebRequestRulesRegistry() {} | 73 virtual ~TestWebRequestRulesRegistry() {} |
| 74 | 74 |
| 75 virtual void ClearCacheOnNavigation() OVERRIDE { | 75 virtual void ClearCacheOnNavigation() override { |
| 76 ++num_clear_cache_calls_; | 76 ++num_clear_cache_calls_; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 int num_clear_cache_calls_; | 80 int num_clear_cache_calls_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 class WebRequestRulesRegistryTest : public testing::Test { | 83 class WebRequestRulesRegistryTest : public testing::Test { |
| 84 public: | 84 public: |
| 85 WebRequestRulesRegistryTest() | 85 WebRequestRulesRegistryTest() |
| 86 : ui_(content::BrowserThread::UI, &message_loop_), | 86 : ui_(content::BrowserThread::UI, &message_loop_), |
| 87 io_(content::BrowserThread::IO, &message_loop_) {} | 87 io_(content::BrowserThread::IO, &message_loop_) {} |
| 88 | 88 |
| 89 virtual ~WebRequestRulesRegistryTest() {} | 89 virtual ~WebRequestRulesRegistryTest() {} |
| 90 | 90 |
| 91 virtual void SetUp() OVERRIDE; | 91 virtual void SetUp() override; |
| 92 | 92 |
| 93 virtual void TearDown() OVERRIDE { | 93 virtual void TearDown() override { |
| 94 // Make sure that deletion traits of all registries are executed. | 94 // Make sure that deletion traits of all registries are executed. |
| 95 message_loop_.RunUntilIdle(); | 95 message_loop_.RunUntilIdle(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Returns a rule that roughly matches http://*.example.com and | 98 // Returns a rule that roughly matches http://*.example.com and |
| 99 // https://www.example.com and cancels it | 99 // https://www.example.com and cancels it |
| 100 linked_ptr<RulesRegistry::Rule> CreateRule1() { | 100 linked_ptr<RulesRegistry::Rule> CreateRule1() { |
| 101 base::ListValue* scheme_http = new base::ListValue(); | 101 base::ListValue* scheme_http = new base::ListValue(); |
| 102 scheme_http->Append(new base::StringValue("http")); | 102 scheme_http->Append(new base::StringValue("http")); |
| 103 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); | 103 base::DictionaryValue* http_condition_dict = new base::DictionaryValue(); |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 // This is a correct match. | 813 // This is a correct match. |
| 814 GURL url2("http://foo.com/index.html"); | 814 GURL url2("http://foo.com/index.html"); |
| 815 scoped_ptr<net::URLRequest> request2(context.CreateRequest( | 815 scoped_ptr<net::URLRequest> request2(context.CreateRequest( |
| 816 url2, net::DEFAULT_PRIORITY, NULL, NULL)); | 816 url2, net::DEFAULT_PRIORITY, NULL, NULL)); |
| 817 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); | 817 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); |
| 818 deltas = registry->CreateDeltas(NULL, request_data2, false); | 818 deltas = registry->CreateDeltas(NULL, request_data2, false); |
| 819 EXPECT_EQ(1u, deltas.size()); | 819 EXPECT_EQ(1u, deltas.size()); |
| 820 } | 820 } |
| 821 | 821 |
| 822 } // namespace extensions | 822 } // namespace extensions |
| OLD | NEW |