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

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

Powered by Google App Engine
This is Rietveld 408576698