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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 ++num_clear_cache_calls_; | 74 ++num_clear_cache_calls_; |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
78 int num_clear_cache_calls_; | 78 int num_clear_cache_calls_; |
79 }; | 79 }; |
80 | 80 |
81 class WebRequestRulesRegistryTest : public testing::Test { | 81 class WebRequestRulesRegistryTest : public testing::Test { |
82 public: | 82 public: |
83 WebRequestRulesRegistryTest() | 83 WebRequestRulesRegistryTest() |
84 : message_loop_(base::MessageLoop::TYPE_IO), | 84 : ui_(content::BrowserThread::UI, &message_loop_), |
85 ui_(content::BrowserThread::UI, &message_loop_), | |
86 io_(content::BrowserThread::IO, &message_loop_) {} | 85 io_(content::BrowserThread::IO, &message_loop_) {} |
87 | 86 |
88 virtual ~WebRequestRulesRegistryTest() {} | 87 virtual ~WebRequestRulesRegistryTest() {} |
89 | 88 |
90 virtual void SetUp() OVERRIDE; | 89 virtual void SetUp() OVERRIDE; |
91 | 90 |
92 virtual void TearDown() OVERRIDE { | 91 virtual void TearDown() OVERRIDE { |
93 // Make sure that deletion traits of all registries are executed. | 92 // Make sure that deletion traits of all registries are executed. |
94 message_loop_.RunUntilIdle(); | 93 message_loop_.RunUntilIdle(); |
95 } | 94 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 rule->priority.reset(new int(1)); | 215 rule->priority.reset(new int(1)); |
217 rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy())); | 216 rule->actions.push_back(linked_ptr<base::Value>(action_dict.DeepCopy())); |
218 for (std::vector<const std::string*>::const_iterator it = | 217 for (std::vector<const std::string*>::const_iterator it = |
219 attributes.begin(); | 218 attributes.begin(); |
220 it != attributes.end(); ++it) | 219 it != attributes.end(); ++it) |
221 rule->conditions.push_back(CreateCondition(**it)); | 220 rule->conditions.push_back(CreateCondition(**it)); |
222 return rule; | 221 return rule; |
223 } | 222 } |
224 | 223 |
225 protected: | 224 protected: |
226 base::MessageLoop message_loop_; | 225 base::MessageLoopForIO message_loop_; |
227 content::TestBrowserThread ui_; | 226 content::TestBrowserThread ui_; |
228 content::TestBrowserThread io_; | 227 content::TestBrowserThread io_; |
229 // Two extensions with host permissions for all URLs and the DWR permission. | 228 // Two extensions with host permissions for all URLs and the DWR permission. |
230 // Installation times will be so that |extension_| is older than | 229 // Installation times will be so that |extension_| is older than |
231 // |extension2_|. | 230 // |extension2_|. |
232 scoped_refptr<Extension> extension_; | 231 scoped_refptr<Extension> extension_; |
233 scoped_refptr<Extension> extension2_; | 232 scoped_refptr<Extension> extension2_; |
234 scoped_refptr<InfoMap> extension_info_map_; | 233 scoped_refptr<InfoMap> extension_info_map_; |
235 }; | 234 }; |
236 | 235 |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
804 | 803 |
805 // This is a correct match. | 804 // This is a correct match. |
806 GURL url2("http://foo.com/index.html"); | 805 GURL url2("http://foo.com/index.html"); |
807 net::TestURLRequest request2(url2, net::DEFAULT_PRIORITY, NULL, &context); | 806 net::TestURLRequest request2(url2, net::DEFAULT_PRIORITY, NULL, &context); |
808 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); | 807 WebRequestData request_data2(&request2, ON_BEFORE_REQUEST); |
809 deltas = registry->CreateDeltas(NULL, request_data2, false); | 808 deltas = registry->CreateDeltas(NULL, request_data2, false); |
810 EXPECT_EQ(1u, deltas.size()); | 809 EXPECT_EQ(1u, deltas.size()); |
811 } | 810 } |
812 | 811 |
813 } // namespace extensions | 812 } // namespace extensions |
OLD | NEW |