| 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 15 matching lines...) Expand all Loading... |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 namespace extensions { | 28 namespace extensions { |
| 29 | 29 |
| 30 namespace helpers = extension_web_request_api_helpers; | 30 namespace helpers = extension_web_request_api_helpers; |
| 31 namespace keys = declarative_webrequest_constants; | 31 namespace keys = declarative_webrequest_constants; |
| 32 namespace keys2 = url_matcher_constants; | 32 namespace keys2 = url_matcher_constants; |
| 33 | 33 |
| 34 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { | 34 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { |
| 35 public: | 35 public: |
| 36 TestWebRequestRulesRegistry() : WebRequestRulesRegistry(NULL) {} | 36 TestWebRequestRulesRegistry() : WebRequestRulesRegistry(NULL, NULL) {} |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 virtual ~TestWebRequestRulesRegistry() {} | 39 virtual ~TestWebRequestRulesRegistry() {} |
| 40 | 40 |
| 41 virtual base::Time GetExtensionInstallationTime( | 41 virtual base::Time GetExtensionInstallationTime( |
| 42 const std::string& extension_id) const { | 42 const std::string& extension_id) const { |
| 43 if (extension_id == kExtensionId) | 43 if (extension_id == kExtensionId) |
| 44 return base::Time() + base::TimeDelta::FromDays(1); | 44 return base::Time() + base::TimeDelta::FromDays(1); |
| 45 else if (extension_id == kExtensionId2) | 45 else if (extension_id == kExtensionId2) |
| 46 return base::Time() + base::TimeDelta::FromDays(2); | 46 return base::Time() + base::TimeDelta::FromDays(2); |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 // The redirect by the first extension is ignored due to the ignore rule. | 389 // The redirect by the first extension is ignored due to the ignore rule. |
| 390 ASSERT_EQ(1u, deltas.size()); | 390 ASSERT_EQ(1u, deltas.size()); |
| 391 LinkedPtrEventResponseDelta effective_rule = *(deltas.begin()); | 391 LinkedPtrEventResponseDelta effective_rule = *(deltas.begin()); |
| 392 | 392 |
| 393 EXPECT_EQ(kExtensionId2, effective_rule->extension_id); | 393 EXPECT_EQ(kExtensionId2, effective_rule->extension_id); |
| 394 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(2), | 394 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(2), |
| 395 effective_rule->extension_install_time); | 395 effective_rule->extension_install_time); |
| 396 EXPECT_EQ(GURL("http://www.bar.com"), effective_rule->new_url); | 396 EXPECT_EQ(GURL("http://www.bar.com"), effective_rule->new_url); |
| 397 } | 397 } |
| 398 } // namespace extensions | 398 } // namespace extensions |
| OLD | NEW |