| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ++num_clear_cache_calls_; | 70 ++num_clear_cache_calls_; |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 int num_clear_cache_calls_; | 74 int num_clear_cache_calls_; |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class WebRequestRulesRegistryTest : public testing::Test { | 77 class WebRequestRulesRegistryTest : public testing::Test { |
| 78 public: | 78 public: |
| 79 WebRequestRulesRegistryTest() | 79 WebRequestRulesRegistryTest() |
| 80 : message_loop(MessageLoop::TYPE_IO), | 80 : message_loop(base::MessageLoop::TYPE_IO), |
| 81 ui(content::BrowserThread::UI, &message_loop), | 81 ui(content::BrowserThread::UI, &message_loop), |
| 82 io(content::BrowserThread::IO, &message_loop) {} | 82 io(content::BrowserThread::IO, &message_loop) {} |
| 83 | 83 |
| 84 virtual ~WebRequestRulesRegistryTest() {} | 84 virtual ~WebRequestRulesRegistryTest() {} |
| 85 | 85 |
| 86 virtual void SetUp() OVERRIDE; | 86 virtual void SetUp() OVERRIDE; |
| 87 | 87 |
| 88 virtual void TearDown() OVERRIDE { | 88 virtual void TearDown() OVERRIDE { |
| 89 // Make sure that deletion traits of all registries are executed. | 89 // Make sure that deletion traits of all registries are executed. |
| 90 message_loop.RunUntilIdle(); | 90 message_loop.RunUntilIdle(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 rule->priority.reset(new int(1)); | 212 rule->priority.reset(new int(1)); |
| 213 rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy())); | 213 rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy())); |
| 214 for (std::vector<const std::string*>::const_iterator it = | 214 for (std::vector<const std::string*>::const_iterator it = |
| 215 attributes.begin(); | 215 attributes.begin(); |
| 216 it != attributes.end(); ++it) | 216 it != attributes.end(); ++it) |
| 217 rule->conditions.push_back(CreateCondition(**it)); | 217 rule->conditions.push_back(CreateCondition(**it)); |
| 218 return rule; | 218 return rule; |
| 219 } | 219 } |
| 220 | 220 |
| 221 protected: | 221 protected: |
| 222 MessageLoop message_loop; | 222 base::MessageLoop message_loop; |
| 223 content::TestBrowserThread ui; | 223 content::TestBrowserThread ui; |
| 224 content::TestBrowserThread io; | 224 content::TestBrowserThread io; |
| 225 // Two extensions with host permissions for all URLs and the DWR permission. | 225 // Two extensions with host permissions for all URLs and the DWR permission. |
| 226 // Installation times will be so that |extension_| is older than | 226 // Installation times will be so that |extension_| is older than |
| 227 // |extension2_|. | 227 // |extension2_|. |
| 228 scoped_refptr<Extension> extension_; | 228 scoped_refptr<Extension> extension_; |
| 229 scoped_refptr<Extension> extension2_; | 229 scoped_refptr<Extension> extension2_; |
| 230 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 230 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
| 231 }; | 231 }; |
| 232 | 232 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 | 795 |
| 796 // This is a correct match. | 796 // This is a correct match. |
| 797 GURL url2("http://foo.com/index.html"); | 797 GURL url2("http://foo.com/index.html"); |
| 798 net::TestURLRequest request2(url2, NULL, &context, NULL); | 798 net::TestURLRequest request2(url2, NULL, &context, NULL); |
| 799 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); | 799 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); |
| 800 deltas = registry->CreateDeltas(NULL, request_data2, false); | 800 deltas = registry->CreateDeltas(NULL, request_data2, false); |
| 801 EXPECT_EQ(1u, deltas.size()); | 801 EXPECT_EQ(1u, deltas.size()); |
| 802 } | 802 } |
| 803 | 803 |
| 804 } // namespace extensions | 804 } // namespace extensions |
| OLD | NEW |