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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 public: | 67 public: |
68 WebRequestRulesRegistryTest() | 68 WebRequestRulesRegistryTest() |
69 : message_loop(MessageLoop::TYPE_IO), | 69 : message_loop(MessageLoop::TYPE_IO), |
70 ui(content::BrowserThread::UI, &message_loop), | 70 ui(content::BrowserThread::UI, &message_loop), |
71 io(content::BrowserThread::IO, &message_loop) {} | 71 io(content::BrowserThread::IO, &message_loop) {} |
72 | 72 |
73 virtual ~WebRequestRulesRegistryTest() {} | 73 virtual ~WebRequestRulesRegistryTest() {} |
74 | 74 |
75 virtual void TearDown() OVERRIDE { | 75 virtual void TearDown() OVERRIDE { |
76 // Make sure that deletion traits of all registries are executed. | 76 // Make sure that deletion traits of all registries are executed. |
77 message_loop.RunAllPending(); | 77 message_loop.RunUntilIdle(); |
78 } | 78 } |
79 | 79 |
80 // Returns a rule that roughly matches http://*.example.com and | 80 // Returns a rule that roughly matches http://*.example.com and |
81 // https://www.example.com and cancels it | 81 // https://www.example.com and cancels it |
82 linked_ptr<RulesRegistry::Rule> CreateRule1() { | 82 linked_ptr<RulesRegistry::Rule> CreateRule1() { |
83 ListValue* scheme_http = new ListValue(); | 83 ListValue* scheme_http = new ListValue(); |
84 scheme_http->Append(Value::CreateStringValue("http")); | 84 scheme_http->Append(Value::CreateStringValue("http")); |
85 DictionaryValue* http_condition_dict = new DictionaryValue(); | 85 DictionaryValue* http_condition_dict = new DictionaryValue(); |
86 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); | 86 http_condition_dict->Set(keys2::kSchemesKey, scheme_http); |
87 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); | 87 http_condition_dict->SetString(keys2::kHostSuffixKey, "example.com"); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 // The redirect by the first extension is ignored due to the ignore rule. | 420 // The redirect by the first extension is ignored due to the ignore rule. |
421 ASSERT_EQ(1u, deltas.size()); | 421 ASSERT_EQ(1u, deltas.size()); |
422 LinkedPtrEventResponseDelta effective_rule = *(deltas.begin()); | 422 LinkedPtrEventResponseDelta effective_rule = *(deltas.begin()); |
423 | 423 |
424 EXPECT_EQ(kExtensionId2, effective_rule->extension_id); | 424 EXPECT_EQ(kExtensionId2, effective_rule->extension_id); |
425 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(2), | 425 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(2), |
426 effective_rule->extension_install_time); | 426 effective_rule->extension_install_time); |
427 EXPECT_EQ(GURL("http://www.bar.com"), effective_rule->new_url); | 427 EXPECT_EQ(GURL("http://www.bar.com"), effective_rule->new_url); |
428 } | 428 } |
429 } // namespace extensions | 429 } // namespace extensions |
OLD | NEW |