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