| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITTEST
_H_ | 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITTEST
_H_ |
| 6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITTEST
_H_ | 6 #define CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITTEST
_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/component_updater/component_updater_service.h" | 13 #include "chrome/browser/component_updater/component_updater_service.h" |
| 14 #include "chrome/browser/component_updater/test/component_patcher_mock.h" | 14 #include "chrome/browser/component_updater/test/component_patcher_mock.h" |
| 15 #include "chrome/browser/component_updater/test/url_request_post_interceptor.h" |
| 15 #include "content/public/test/test_notification_tracker.h" | 16 #include "content/public/test/test_notification_tracker.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 using content::TestNotificationTracker; | 19 using content::TestNotificationTracker; |
| 19 | 20 |
| 20 class GURL; | 21 class GURL; |
| 21 class TestInstaller; | 22 class TestInstaller; |
| 22 | 23 |
| 23 // component 1 has extension id "jebgalgnebhfojomionfpkfelancnnkf", and | 24 // component 1 has extension id "jebgalgnebhfojomionfpkfelancnnkf", and |
| 24 // the RSA public key the following hash: | 25 // the RSA public key the following hash: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 52 virtual int NextCheckDelay() OVERRIDE; | 53 virtual int NextCheckDelay() OVERRIDE; |
| 53 | 54 |
| 54 virtual int StepDelay() OVERRIDE; | 55 virtual int StepDelay() OVERRIDE; |
| 55 | 56 |
| 56 virtual int MinimumReCheckWait() OVERRIDE; | 57 virtual int MinimumReCheckWait() OVERRIDE; |
| 57 | 58 |
| 58 virtual int OnDemandDelay() OVERRIDE; | 59 virtual int OnDemandDelay() OVERRIDE; |
| 59 | 60 |
| 60 virtual GURL UpdateUrl() OVERRIDE; | 61 virtual GURL UpdateUrl() OVERRIDE; |
| 61 | 62 |
| 63 virtual GURL PingUrl() OVERRIDE; |
| 64 |
| 62 virtual const char* ExtraRequestParams() OVERRIDE; | 65 virtual const char* ExtraRequestParams() OVERRIDE; |
| 63 | 66 |
| 64 virtual size_t UrlSizeLimit() OVERRIDE; | 67 virtual size_t UrlSizeLimit() OVERRIDE; |
| 65 | 68 |
| 66 virtual net::URLRequestContextGetter* RequestContext() OVERRIDE; | 69 virtual net::URLRequestContextGetter* RequestContext() OVERRIDE; |
| 67 | 70 |
| 68 // Don't use the utility process to decode files. | 71 // Don't use the utility process to decode files. |
| 69 virtual bool InProcess() OVERRIDE; | 72 virtual bool InProcess() OVERRIDE; |
| 70 | 73 |
| 71 virtual void OnEvent(Events event, int extra) OVERRIDE; | |
| 72 | |
| 73 virtual ComponentPatcher* CreateComponentPatcher() OVERRIDE; | 74 virtual ComponentPatcher* CreateComponentPatcher() OVERRIDE; |
| 74 | 75 |
| 75 virtual bool DeltasEnabled() const OVERRIDE; | 76 virtual bool DeltasEnabled() const OVERRIDE; |
| 76 | 77 |
| 77 void SetLoopCount(int times); | 78 void SetLoopCount(int times); |
| 78 | 79 |
| 79 void SetRecheckTime(int seconds); | 80 void SetRecheckTime(int seconds); |
| 80 | 81 |
| 81 void SetOnDemandTime(int seconds); | 82 void SetOnDemandTime(int seconds); |
| 82 | 83 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 private: | 125 private: |
| 125 scoped_ptr<ComponentUpdateService> component_updater_; | 126 scoped_ptr<ComponentUpdateService> component_updater_; |
| 126 base::FilePath test_data_dir_; | 127 base::FilePath test_data_dir_; |
| 127 TestNotificationTracker notification_tracker_; | 128 TestNotificationTracker notification_tracker_; |
| 128 TestConfigurator* test_config_; | 129 TestConfigurator* test_config_; |
| 129 }; | 130 }; |
| 130 | 131 |
| 131 const char expected_crx_url[] = | 132 const char expected_crx_url[] = |
| 132 "http://localhost/download/jebgalgnebhfojomionfpkfelancnnkf.crx"; | 133 "http://localhost/download/jebgalgnebhfojomionfpkfelancnnkf.crx"; |
| 133 | 134 |
| 135 class PingChecker : public RequestCounter { |
| 136 public: |
| 137 explicit PingChecker(const std::map<std::string, std::string>& attributes); |
| 138 |
| 139 virtual ~PingChecker(); |
| 140 |
| 141 virtual void Trial(net::URLRequest* request) OVERRIDE; |
| 142 |
| 143 int NumHits() const { |
| 144 return num_hits_; |
| 145 } |
| 146 int NumMisses() const { |
| 147 return num_misses_; |
| 148 } |
| 149 |
| 150 private: |
| 151 int num_hits_; |
| 152 int num_misses_; |
| 153 const std::map<std::string, std::string> attributes_; |
| 154 virtual bool Test(net::URLRequest* request); |
| 155 }; |
| 156 |
| 134 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITT
EST_H_ | 157 #endif // CHROME_BROWSER_COMPONENT_UPDATER_TEST_COMPONENT_UPDATER_SERVICE_UNITT
EST_H_ |
| OLD | NEW |