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

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

Powered by Google App Engine
This is Rietveld 408576698