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 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 | 28 |
29 namespace helpers = extension_web_request_api_helpers; | 29 namespace helpers = extension_web_request_api_helpers; |
30 namespace keys = declarative_webrequest_constants; | 30 namespace keys = declarative_webrequest_constants; |
31 namespace keys2 = url_matcher_constants; | 31 namespace keys2 = url_matcher_constants; |
32 | 32 |
33 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { | 33 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { |
34 public: | 34 public: |
35 TestWebRequestRulesRegistry() : WebRequestRulesRegistry(NULL) {} | 35 TestWebRequestRulesRegistry() : WebRequestRulesRegistry(NULL) {} |
| 36 |
| 37 protected: |
36 virtual ~TestWebRequestRulesRegistry() {} | 38 virtual ~TestWebRequestRulesRegistry() {} |
37 | 39 |
38 protected: | |
39 virtual base::Time GetExtensionInstallationTime( | 40 virtual base::Time GetExtensionInstallationTime( |
40 const std::string& extension_id) const { | 41 const std::string& extension_id) const { |
41 if (extension_id == kExtensionId) | 42 if (extension_id == kExtensionId) |
42 return base::Time() + base::TimeDelta::FromDays(1); | 43 return base::Time() + base::TimeDelta::FromDays(1); |
43 else if (extension_id == kExtensionId2) | 44 else if (extension_id == kExtensionId2) |
44 return base::Time() + base::TimeDelta::FromDays(2); | 45 return base::Time() + base::TimeDelta::FromDays(2); |
45 else | 46 else |
46 return base::Time(); | 47 return base::Time(); |
47 } | 48 } |
48 }; | 49 }; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 winner->extension_install_time); | 322 winner->extension_install_time); |
322 EXPECT_EQ(GURL("http://www.bar.com"), winner->new_url); | 323 EXPECT_EQ(GURL("http://www.bar.com"), winner->new_url); |
323 | 324 |
324 EXPECT_EQ(kExtensionId, loser->extension_id); | 325 EXPECT_EQ(kExtensionId, loser->extension_id); |
325 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(1), | 326 EXPECT_EQ(base::Time() + base::TimeDelta::FromDays(1), |
326 loser->extension_install_time); | 327 loser->extension_install_time); |
327 EXPECT_EQ(GURL("http://www.foo.com"), loser->new_url); | 328 EXPECT_EQ(GURL("http://www.foo.com"), loser->new_url); |
328 } | 329 } |
329 | 330 |
330 } // namespace extensions | 331 } // namespace extensions |
OLD | NEW |