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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // to be cleared. | 63 // to be cleared. |
64 int num_clear_cache_calls() const { return num_clear_cache_calls_; } | 64 int num_clear_cache_calls() const { return num_clear_cache_calls_; } |
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 ~TestWebRequestRulesRegistry() override {} |
74 | 74 |
75 virtual void ClearCacheOnNavigation() override { | 75 void ClearCacheOnNavigation() override { ++num_clear_cache_calls_; } |
76 ++num_clear_cache_calls_; | |
77 } | |
78 | 76 |
79 private: | 77 private: |
80 int num_clear_cache_calls_; | 78 int num_clear_cache_calls_; |
81 }; | 79 }; |
82 | 80 |
83 class WebRequestRulesRegistryTest : public testing::Test { | 81 class WebRequestRulesRegistryTest : public testing::Test { |
84 public: | 82 public: |
85 WebRequestRulesRegistryTest() | 83 WebRequestRulesRegistryTest() |
86 : ui_(content::BrowserThread::UI, &message_loop_), | 84 : ui_(content::BrowserThread::UI, &message_loop_), |
87 io_(content::BrowserThread::IO, &message_loop_) {} | 85 io_(content::BrowserThread::IO, &message_loop_) {} |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 // This is a correct match. | 811 // This is a correct match. |
814 GURL url2("http://foo.com/index.html"); | 812 GURL url2("http://foo.com/index.html"); |
815 scoped_ptr<net::URLRequest> request2(context.CreateRequest( | 813 scoped_ptr<net::URLRequest> request2(context.CreateRequest( |
816 url2, net::DEFAULT_PRIORITY, NULL, NULL)); | 814 url2, net::DEFAULT_PRIORITY, NULL, NULL)); |
817 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); | 815 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); |
818 deltas = registry->CreateDeltas(NULL, request_data2, false); | 816 deltas = registry->CreateDeltas(NULL, request_data2, false); |
819 EXPECT_EQ(1u, deltas.size()); | 817 EXPECT_EQ(1u, deltas.size()); |
820 } | 818 } |
821 | 819 |
822 } // namespace extensions | 820 } // namespace extensions |
OLD | NEW |