| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 using base::Value; | 42 using base::Value; |
| 43 using testing::HasSubstr; | 43 using testing::HasSubstr; |
| 44 | 44 |
| 45 namespace helpers = extension_web_request_api_helpers; | 45 namespace helpers = extension_web_request_api_helpers; |
| 46 namespace keys = declarative_webrequest_constants; | 46 namespace keys = declarative_webrequest_constants; |
| 47 namespace keys2 = url_matcher_constants; | 47 namespace keys2 = url_matcher_constants; |
| 48 | 48 |
| 49 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { | 49 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { |
| 50 public: | 50 public: |
| 51 explicit TestWebRequestRulesRegistry( | 51 TestWebRequestRulesRegistry( |
| 52 scoped_refptr<InfoMap> extension_info_map) | 52 scoped_refptr<InfoMap> extension_info_map) |
| 53 : WebRequestRulesRegistry(NULL /*profile*/, NULL /* cache_delegate */), | 53 : WebRequestRulesRegistry(NULL /*profile*/, |
| 54 NULL /* cache_delegate */, |
| 55 WebViewKey(0, 0)), |
| 54 num_clear_cache_calls_(0) { | 56 num_clear_cache_calls_(0) { |
| 55 SetExtensionInfoMapForTesting(extension_info_map); | 57 SetExtensionInfoMapForTesting(extension_info_map); |
| 56 } | 58 } |
| 57 | 59 |
| 58 // Returns how often the in-memory caches of the renderers were instructed | 60 // Returns how often the in-memory caches of the renderers were instructed |
| 59 // to be cleared. | 61 // to be cleared. |
| 60 int num_clear_cache_calls() const { return num_clear_cache_calls_; } | 62 int num_clear_cache_calls() const { return num_clear_cache_calls_; } |
| 61 | 63 |
| 62 // How many rules are there which have some conditions not triggered by URL | 64 // How many rules are there which have some conditions not triggered by URL |
| 63 // matches. | 65 // matches. |
| (...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 | 802 |
| 801 // This is a correct match. | 803 // This is a correct match. |
| 802 GURL url2("http://foo.com/index.html"); | 804 GURL url2("http://foo.com/index.html"); |
| 803 net::TestURLRequest request2(url2, net::DEFAULT_PRIORITY, NULL, &context); | 805 net::TestURLRequest request2(url2, net::DEFAULT_PRIORITY, NULL, &context); |
| 804 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); | 806 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); |
| 805 deltas = registry->CreateDeltas(NULL, request_data2, false); | 807 deltas = registry->CreateDeltas(NULL, request_data2, false); |
| 806 EXPECT_EQ(1u, deltas.size()); | 808 EXPECT_EQ(1u, deltas.size()); |
| 807 } | 809 } |
| 808 | 810 |
| 809 } // namespace extensions | 811 } // namespace extensions |
| OLD | NEW |