Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: components/update_client/update_client_unittest.cc

Issue 1861383004: Add module for counting date-last-roll-call and persisting those counts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/test/sequenced_worker_pool_owner.h" 18 #include "base/test/sequenced_worker_pool_owner.h"
19 #include "base/thread_task_runner_handle.h" 19 #include "base/thread_task_runner_handle.h"
20 #include "base/values.h" 20 #include "base/values.h"
21 #include "base/version.h" 21 #include "base/version.h"
22 #include "components/update_client/component_metadata.h"
22 #include "components/update_client/crx_update_item.h" 23 #include "components/update_client/crx_update_item.h"
23 #include "components/update_client/ping_manager.h" 24 #include "components/update_client/ping_manager.h"
24 #include "components/update_client/test_configurator.h" 25 #include "components/update_client/test_configurator.h"
25 #include "components/update_client/test_installer.h" 26 #include "components/update_client/test_installer.h"
26 #include "components/update_client/update_checker.h" 27 #include "components/update_client/update_checker.h"
27 #include "components/update_client/update_client_internal.h" 28 #include "components/update_client/update_client_internal.h"
28 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
29 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
30 #include "url/gurl.h" 31 #include "url/gurl.h"
31 32
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 UpdateClientTest(); 140 UpdateClientTest();
140 ~UpdateClientTest() override; 141 ~UpdateClientTest() override;
141 142
142 protected: 143 protected:
143 void RunThreads(); 144 void RunThreads();
144 145
145 // Returns the full path to a test file. 146 // Returns the full path to a test file.
146 static base::FilePath TestFilePath(const char* file); 147 static base::FilePath TestFilePath(const char* file);
147 148
148 scoped_refptr<update_client::Configurator> config() { return config_; } 149 scoped_refptr<update_client::Configurator> config() { return config_; }
150 scoped_refptr<update_client::ComponentMetadata> metadata() {
151 return metadata_;
152 }
149 153
150 base::Closure quit_closure() { return quit_closure_; } 154 base::Closure quit_closure() { return quit_closure_; }
151 155
152 private: 156 private:
153 static const int kNumWorkerThreads_ = 2; 157 static const int kNumWorkerThreads_ = 2;
154 158
155 base::MessageLoopForUI message_loop_; 159 base::MessageLoopForUI message_loop_;
156 base::RunLoop runloop_; 160 base::RunLoop runloop_;
157 base::Closure quit_closure_; 161 base::Closure quit_closure_;
158 162
159 scoped_ptr<base::SequencedWorkerPoolOwner> worker_pool_; 163 scoped_ptr<base::SequencedWorkerPoolOwner> worker_pool_;
160 164
161 scoped_refptr<update_client::Configurator> config_; 165 scoped_refptr<update_client::Configurator> config_;
166 scoped_refptr<update_client::ComponentMetadata> metadata_;
162 167
163 DISALLOW_COPY_AND_ASSIGN(UpdateClientTest); 168 DISALLOW_COPY_AND_ASSIGN(UpdateClientTest);
164 }; 169 };
165 170
166 UpdateClientTest::UpdateClientTest() 171 UpdateClientTest::UpdateClientTest()
167 : worker_pool_( 172 : worker_pool_(
168 new base::SequencedWorkerPoolOwner(kNumWorkerThreads_, "test")) { 173 new base::SequencedWorkerPoolOwner(kNumWorkerThreads_, "test")) {
169 quit_closure_ = runloop_.QuitClosure(); 174 quit_closure_ = runloop_.QuitClosure();
170 175
171 auto pool = worker_pool_->pool(); 176 auto pool = worker_pool_->pool();
172 config_ = new TestConfigurator( 177 config_ = new TestConfigurator(
173 pool->GetSequencedTaskRunner(pool->GetSequenceToken()), 178 pool->GetSequencedTaskRunner(pool->GetSequenceToken()),
174 message_loop_.task_runner()); 179 message_loop_.task_runner());
180 metadata_ = new ComponentMetadata(
181 base::FilePath(), message_loop_.task_runner());
175 } 182 }
176 183
177 UpdateClientTest::~UpdateClientTest() { 184 UpdateClientTest::~UpdateClientTest() {
178 } 185 }
179 186
180 void UpdateClientTest::RunThreads() { 187 void UpdateClientTest::RunThreads() {
181 runloop_.Run(); 188 runloop_.Run();
182 } 189 }
183 190
184 base::FilePath UpdateClientTest::TestFilePath(const char* file) { 191 base::FilePath UpdateClientTest::TestFilePath(const char* file) {
(...skipping 26 matching lines...) Expand all
211 public: 218 public:
212 static void Callback(const base::Closure& quit_closure, int error) { 219 static void Callback(const base::Closure& quit_closure, int error) {
213 EXPECT_EQ(0, error); 220 EXPECT_EQ(0, error);
214 quit_closure.Run(); 221 quit_closure.Run();
215 } 222 }
216 }; 223 };
217 224
218 class FakeUpdateChecker : public UpdateChecker { 225 class FakeUpdateChecker : public UpdateChecker {
219 public: 226 public:
220 static scoped_ptr<UpdateChecker> Create( 227 static scoped_ptr<UpdateChecker> Create(
221 const scoped_refptr<Configurator>& config) { 228 const scoped_refptr<Configurator>& config,
229 const scoped_refptr<ComponentMetadata>& metadata) {
222 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 230 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
223 } 231 }
224 232
225 bool CheckForUpdates( 233 bool CheckForUpdates(
226 const std::vector<CrxUpdateItem*>& items_to_check, 234 const std::vector<CrxUpdateItem*>& items_to_check,
227 const std::string& additional_attributes, 235 const std::string& additional_attributes,
228 const UpdateCheckCallback& update_check_callback) override { 236 const UpdateCheckCallback& update_check_callback) override {
229 base::ThreadTaskRunnerHandle::Get()->PostTask( 237 base::ThreadTaskRunnerHandle::Get()->PostTask(
230 FROM_HERE, 238 FROM_HERE,
231 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); 239 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 public: 325 public:
318 static void Callback(const base::Closure& quit_closure, int error) { 326 static void Callback(const base::Closure& quit_closure, int error) {
319 EXPECT_EQ(0, error); 327 EXPECT_EQ(0, error);
320 quit_closure.Run(); 328 quit_closure.Run();
321 } 329 }
322 }; 330 };
323 331
324 class FakeUpdateChecker : public UpdateChecker { 332 class FakeUpdateChecker : public UpdateChecker {
325 public: 333 public:
326 static scoped_ptr<UpdateChecker> Create( 334 static scoped_ptr<UpdateChecker> Create(
327 const scoped_refptr<Configurator>& config) { 335 const scoped_refptr<Configurator>& config,
336 const scoped_refptr<ComponentMetadata>& metadata) {
328 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 337 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
329 } 338 }
330 339
331 bool CheckForUpdates( 340 bool CheckForUpdates(
332 const std::vector<CrxUpdateItem*>& items_to_check, 341 const std::vector<CrxUpdateItem*>& items_to_check,
333 const std::string& additional_attributes, 342 const std::string& additional_attributes,
334 const UpdateCheckCallback& update_check_callback) override { 343 const UpdateCheckCallback& update_check_callback) override {
335 /* 344 /*
336 Fake the following response: 345 Fake the following response:
337 346
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 public: 511 public:
503 static void Callback(const base::Closure& quit_closure, int error) { 512 static void Callback(const base::Closure& quit_closure, int error) {
504 EXPECT_EQ(0, error); 513 EXPECT_EQ(0, error);
505 quit_closure.Run(); 514 quit_closure.Run();
506 } 515 }
507 }; 516 };
508 517
509 class FakeUpdateChecker : public UpdateChecker { 518 class FakeUpdateChecker : public UpdateChecker {
510 public: 519 public:
511 static scoped_ptr<UpdateChecker> Create( 520 static scoped_ptr<UpdateChecker> Create(
512 const scoped_refptr<Configurator>& config) { 521 const scoped_refptr<Configurator>& config,
522 const scoped_refptr<ComponentMetadata>& metadata) {
513 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 523 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
514 } 524 }
515 525
516 bool CheckForUpdates( 526 bool CheckForUpdates(
517 const std::vector<CrxUpdateItem*>& items_to_check, 527 const std::vector<CrxUpdateItem*>& items_to_check,
518 const std::string& additional_attributes, 528 const std::string& additional_attributes,
519 const UpdateCheckCallback& update_check_callback) override { 529 const UpdateCheckCallback& update_check_callback) override {
520 /* 530 /*
521 Fake the following response: 531 Fake the following response:
522 532
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 public: 759 public:
750 static void Callback(const base::Closure& quit_closure, int error) { 760 static void Callback(const base::Closure& quit_closure, int error) {
751 EXPECT_EQ(0, error); 761 EXPECT_EQ(0, error);
752 quit_closure.Run(); 762 quit_closure.Run();
753 } 763 }
754 }; 764 };
755 765
756 class FakeUpdateChecker : public UpdateChecker { 766 class FakeUpdateChecker : public UpdateChecker {
757 public: 767 public:
758 static scoped_ptr<UpdateChecker> Create( 768 static scoped_ptr<UpdateChecker> Create(
759 const scoped_refptr<Configurator>& config) { 769 const scoped_refptr<Configurator>& config,
770 const scoped_refptr<ComponentMetadata>& metadata) {
760 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 771 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
761 } 772 }
762 773
763 bool CheckForUpdates( 774 bool CheckForUpdates(
764 const std::vector<CrxUpdateItem*>& items_to_check, 775 const std::vector<CrxUpdateItem*>& items_to_check,
765 const std::string& additional_attributes, 776 const std::string& additional_attributes,
766 const UpdateCheckCallback& update_check_callback) override { 777 const UpdateCheckCallback& update_check_callback) override {
767 /* 778 /*
768 Fake the following response: 779 Fake the following response:
769 780
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 public: 1010 public:
1000 static void Callback(const base::Closure& quit_closure, int error) { 1011 static void Callback(const base::Closure& quit_closure, int error) {
1001 EXPECT_EQ(0, error); 1012 EXPECT_EQ(0, error);
1002 quit_closure.Run(); 1013 quit_closure.Run();
1003 } 1014 }
1004 }; 1015 };
1005 1016
1006 class FakeUpdateChecker : public UpdateChecker { 1017 class FakeUpdateChecker : public UpdateChecker {
1007 public: 1018 public:
1008 static scoped_ptr<UpdateChecker> Create( 1019 static scoped_ptr<UpdateChecker> Create(
1009 const scoped_refptr<Configurator>& config) { 1020 const scoped_refptr<Configurator>& config,
1021 const scoped_refptr<ComponentMetadata>& metadata) {
1010 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 1022 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
1011 } 1023 }
1012 1024
1013 bool CheckForUpdates( 1025 bool CheckForUpdates(
1014 const std::vector<CrxUpdateItem*>& items_to_check, 1026 const std::vector<CrxUpdateItem*>& items_to_check,
1015 const std::string& additional_attributes, 1027 const std::string& additional_attributes,
1016 const UpdateCheckCallback& update_check_callback) override { 1028 const UpdateCheckCallback& update_check_callback) override {
1017 static int num_call = 0; 1029 static int num_call = 0;
1018 ++num_call; 1030 ++num_call;
1019 1031
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 public: 1302 public:
1291 static void Callback(const base::Closure& quit_closure, int error) { 1303 static void Callback(const base::Closure& quit_closure, int error) {
1292 EXPECT_EQ(0, error); 1304 EXPECT_EQ(0, error);
1293 quit_closure.Run(); 1305 quit_closure.Run();
1294 } 1306 }
1295 }; 1307 };
1296 1308
1297 class FakeUpdateChecker : public UpdateChecker { 1309 class FakeUpdateChecker : public UpdateChecker {
1298 public: 1310 public:
1299 static scoped_ptr<UpdateChecker> Create( 1311 static scoped_ptr<UpdateChecker> Create(
1300 const scoped_refptr<Configurator>& config) { 1312 const scoped_refptr<Configurator>& config,
1313 const scoped_refptr<ComponentMetadata>& metadata) {
1301 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 1314 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
1302 } 1315 }
1303 1316
1304 bool CheckForUpdates( 1317 bool CheckForUpdates(
1305 const std::vector<CrxUpdateItem*>& items_to_check, 1318 const std::vector<CrxUpdateItem*>& items_to_check,
1306 const std::string& additional_attributes, 1319 const std::string& additional_attributes,
1307 const UpdateCheckCallback& update_check_callback) override { 1320 const UpdateCheckCallback& update_check_callback) override {
1308 /* 1321 /*
1309 Fake the following response: 1322 Fake the following response:
1310 1323
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 public: 1486 public:
1474 static void Callback(const base::Closure& quit_closure, int error) { 1487 static void Callback(const base::Closure& quit_closure, int error) {
1475 EXPECT_EQ(0, error); 1488 EXPECT_EQ(0, error);
1476 quit_closure.Run(); 1489 quit_closure.Run();
1477 } 1490 }
1478 }; 1491 };
1479 1492
1480 class FakeUpdateChecker : public UpdateChecker { 1493 class FakeUpdateChecker : public UpdateChecker {
1481 public: 1494 public:
1482 static scoped_ptr<UpdateChecker> Create( 1495 static scoped_ptr<UpdateChecker> Create(
1483 const scoped_refptr<Configurator>& config) { 1496 const scoped_refptr<Configurator>& config,
1497 const scoped_refptr<ComponentMetadata>& metadata) {
1484 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 1498 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
1485 } 1499 }
1486 1500
1487 bool CheckForUpdates( 1501 bool CheckForUpdates(
1488 const std::vector<CrxUpdateItem*>& items_to_check, 1502 const std::vector<CrxUpdateItem*>& items_to_check,
1489 const std::string& additional_attributes, 1503 const std::string& additional_attributes,
1490 const UpdateCheckCallback& update_check_callback) override { 1504 const UpdateCheckCallback& update_check_callback) override {
1491 static int num_call = 0; 1505 static int num_call = 0;
1492 ++num_call; 1506 ++num_call;
1493 1507
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1762 EXPECT_EQ(0, error); 1776 EXPECT_EQ(0, error);
1763 1777
1764 if (num_call == 2) 1778 if (num_call == 2)
1765 quit_closure.Run(); 1779 quit_closure.Run();
1766 } 1780 }
1767 }; 1781 };
1768 1782
1769 class FakeUpdateChecker : public UpdateChecker { 1783 class FakeUpdateChecker : public UpdateChecker {
1770 public: 1784 public:
1771 static scoped_ptr<UpdateChecker> Create( 1785 static scoped_ptr<UpdateChecker> Create(
1772 const scoped_refptr<Configurator>& config) { 1786 const scoped_refptr<Configurator>& config,
1787 const scoped_refptr<ComponentMetadata>& metadata) {
1773 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 1788 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
1774 } 1789 }
1775 1790
1776 bool CheckForUpdates( 1791 bool CheckForUpdates(
1777 const std::vector<CrxUpdateItem*>& items_to_check, 1792 const std::vector<CrxUpdateItem*>& items_to_check,
1778 const std::string& additional_attributes, 1793 const std::string& additional_attributes,
1779 const UpdateCheckCallback& update_check_callback) override { 1794 const UpdateCheckCallback& update_check_callback) override {
1780 base::ThreadTaskRunnerHandle::Get()->PostTask( 1795 base::ThreadTaskRunnerHandle::Get()->PostTask(
1781 FROM_HERE, 1796 FROM_HERE,
1782 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); 1797 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1861 public: 1876 public:
1862 static void Callback(const base::Closure& quit_closure, int error) { 1877 static void Callback(const base::Closure& quit_closure, int error) {
1863 EXPECT_EQ(0, error); 1878 EXPECT_EQ(0, error);
1864 quit_closure.Run(); 1879 quit_closure.Run();
1865 } 1880 }
1866 }; 1881 };
1867 1882
1868 class FakeUpdateChecker : public UpdateChecker { 1883 class FakeUpdateChecker : public UpdateChecker {
1869 public: 1884 public:
1870 static scoped_ptr<UpdateChecker> Create( 1885 static scoped_ptr<UpdateChecker> Create(
1871 const scoped_refptr<Configurator>& config) { 1886 const scoped_refptr<Configurator>& config,
1887 const scoped_refptr<ComponentMetadata>& metadata) {
1872 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 1888 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
1873 } 1889 }
1874 1890
1875 bool CheckForUpdates( 1891 bool CheckForUpdates(
1876 const std::vector<CrxUpdateItem*>& items_to_check, 1892 const std::vector<CrxUpdateItem*>& items_to_check,
1877 const std::string& additional_attributes, 1893 const std::string& additional_attributes,
1878 const UpdateCheckCallback& update_check_callback) override { 1894 const UpdateCheckCallback& update_check_callback) override {
1879 /* 1895 /*
1880 Fake the following response: 1896 Fake the following response:
1881 1897
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2047 if (num_call == 2) { 2063 if (num_call == 2) {
2048 EXPECT_EQ(0, error); 2064 EXPECT_EQ(0, error);
2049 quit_closure.Run(); 2065 quit_closure.Run();
2050 } 2066 }
2051 } 2067 }
2052 }; 2068 };
2053 2069
2054 class FakeUpdateChecker : public UpdateChecker { 2070 class FakeUpdateChecker : public UpdateChecker {
2055 public: 2071 public:
2056 static scoped_ptr<UpdateChecker> Create( 2072 static scoped_ptr<UpdateChecker> Create(
2057 const scoped_refptr<Configurator>& config) { 2073 const scoped_refptr<Configurator>& config,
2074 const scoped_refptr<ComponentMetadata>& metadata) {
2058 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 2075 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
2059 } 2076 }
2060 2077
2061 bool CheckForUpdates( 2078 bool CheckForUpdates(
2062 const std::vector<CrxUpdateItem*>& items_to_check, 2079 const std::vector<CrxUpdateItem*>& items_to_check,
2063 const std::string& additional_attributes, 2080 const std::string& additional_attributes,
2064 const UpdateCheckCallback& update_check_callback) override { 2081 const UpdateCheckCallback& update_check_callback) override {
2065 base::ThreadTaskRunnerHandle::Get()->PostTask( 2082 base::ThreadTaskRunnerHandle::Get()->PostTask(
2066 FROM_HERE, 2083 FROM_HERE,
2067 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); 2084 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0));
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 2157
2141 class CompletionCallbackFake { 2158 class CompletionCallbackFake {
2142 public: 2159 public:
2143 static void Callback(const base::Closure& quit_closure, int error) { 2160 static void Callback(const base::Closure& quit_closure, int error) {
2144 quit_closure.Run(); 2161 quit_closure.Run();
2145 } 2162 }
2146 }; 2163 };
2147 class FakeUpdateChecker : public UpdateChecker { 2164 class FakeUpdateChecker : public UpdateChecker {
2148 public: 2165 public:
2149 static scoped_ptr<UpdateChecker> Create( 2166 static scoped_ptr<UpdateChecker> Create(
2150 const scoped_refptr<Configurator>& config) { 2167 const scoped_refptr<Configurator>& config,
2168 const scoped_refptr<ComponentMetadata>& metadata) {
2151 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 2169 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
2152 } 2170 }
2153 2171
2154 bool CheckForUpdates( 2172 bool CheckForUpdates(
2155 const std::vector<CrxUpdateItem*>& items_to_check, 2173 const std::vector<CrxUpdateItem*>& items_to_check,
2156 const std::string& additional_attributes, 2174 const std::string& additional_attributes,
2157 const UpdateCheckCallback& update_check_callback) override { 2175 const UpdateCheckCallback& update_check_callback) override {
2158 return false; 2176 return false;
2159 } 2177 }
2160 }; 2178 };
(...skipping 24 matching lines...) Expand all
2185 update_client->Update( 2203 update_client->Update(
2186 empty_id_list, base::Bind(&DataCallbackFake::Callback), 2204 empty_id_list, base::Bind(&DataCallbackFake::Callback),
2187 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); 2205 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure()));
2188 runloop.Run(); 2206 runloop.Run();
2189 } 2207 }
2190 2208
2191 TEST_F(UpdateClientTest, SendUninstallPing) { 2209 TEST_F(UpdateClientTest, SendUninstallPing) {
2192 class FakeUpdateChecker : public UpdateChecker { 2210 class FakeUpdateChecker : public UpdateChecker {
2193 public: 2211 public:
2194 static scoped_ptr<UpdateChecker> Create( 2212 static scoped_ptr<UpdateChecker> Create(
2195 const scoped_refptr<Configurator>& config) { 2213 const scoped_refptr<Configurator>& config,
2214 const scoped_refptr<ComponentMetadata>& metadata) {
2196 return nullptr; 2215 return nullptr;
2197 } 2216 }
2198 2217
2199 bool CheckForUpdates( 2218 bool CheckForUpdates(
2200 const std::vector<CrxUpdateItem*>& items_to_check, 2219 const std::vector<CrxUpdateItem*>& items_to_check,
2201 const std::string& additional_attributes, 2220 const std::string& additional_attributes,
2202 const UpdateCheckCallback& update_check_callback) override { 2221 const UpdateCheckCallback& update_check_callback) override {
2203 return false; 2222 return false;
2204 } 2223 }
2205 }; 2224 };
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 EXPECT_EQ(0, error); 2301 EXPECT_EQ(0, error);
2283 } 2302 }
2284 2303
2285 quit_closure.Run(); 2304 quit_closure.Run();
2286 } 2305 }
2287 }; 2306 };
2288 2307
2289 class FakeUpdateChecker : public UpdateChecker { 2308 class FakeUpdateChecker : public UpdateChecker {
2290 public: 2309 public:
2291 static scoped_ptr<UpdateChecker> Create( 2310 static scoped_ptr<UpdateChecker> Create(
2292 const scoped_refptr<Configurator>& config) { 2311 const scoped_refptr<Configurator>& config,
2312 const scoped_refptr<ComponentMetadata>& metadata) {
2293 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); 2313 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker());
2294 } 2314 }
2295 2315
2296 bool CheckForUpdates( 2316 bool CheckForUpdates(
2297 const std::vector<CrxUpdateItem*>& items_to_check, 2317 const std::vector<CrxUpdateItem*>& items_to_check,
2298 const std::string& additional_attributes, 2318 const std::string& additional_attributes,
2299 const UpdateCheckCallback& update_check_callback) override { 2319 const UpdateCheckCallback& update_check_callback) override {
2300 static int num_call = 0; 2320 static int num_call = 0;
2301 ++num_call; 2321 ++num_call;
2302 2322
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 update_client->Update( 2428 update_client->Update(
2409 ids, base::Bind(&DataCallbackFake::Callback), 2429 ids, base::Bind(&DataCallbackFake::Callback),
2410 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); 2430 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure()));
2411 runloop.Run(); 2431 runloop.Run();
2412 } 2432 }
2413 2433
2414 update_client->RemoveObserver(&observer); 2434 update_client->RemoveObserver(&observer);
2415 } 2435 }
2416 2436
2417 } // namespace update_client 2437 } // namespace update_client
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698