| 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" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 UpdateClientTest(); | 141 UpdateClientTest(); |
| 142 ~UpdateClientTest() override; | 142 ~UpdateClientTest() override; |
| 143 | 143 |
| 144 protected: | 144 protected: |
| 145 void RunThreads(); | 145 void RunThreads(); |
| 146 | 146 |
| 147 // Returns the full path to a test file. | 147 // Returns the full path to a test file. |
| 148 static base::FilePath TestFilePath(const char* file); | 148 static base::FilePath TestFilePath(const char* file); |
| 149 | 149 |
| 150 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_; } | 151 update_client::PersistedData* metadata() { return metadata_.get(); } |
| 152 | 152 |
| 153 base::Closure quit_closure() { return quit_closure_; } | 153 base::Closure quit_closure() { return quit_closure_; } |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 static const int kNumWorkerThreads_ = 2; | 156 static const int kNumWorkerThreads_ = 2; |
| 157 | 157 |
| 158 base::MessageLoopForUI message_loop_; | 158 base::MessageLoopForUI message_loop_; |
| 159 base::RunLoop runloop_; | 159 base::RunLoop runloop_; |
| 160 base::Closure quit_closure_; | 160 base::Closure quit_closure_; |
| 161 | 161 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 static void Callback(const base::Closure& quit_closure, int error) { | 220 static void Callback(const base::Closure& quit_closure, int error) { |
| 221 EXPECT_EQ(0, error); | 221 EXPECT_EQ(0, error); |
| 222 quit_closure.Run(); | 222 quit_closure.Run(); |
| 223 } | 223 } |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 class FakeUpdateChecker : public UpdateChecker { | 226 class FakeUpdateChecker : public UpdateChecker { |
| 227 public: | 227 public: |
| 228 static scoped_ptr<UpdateChecker> Create( | 228 static scoped_ptr<UpdateChecker> Create( |
| 229 const scoped_refptr<Configurator>& config, | 229 const scoped_refptr<Configurator>& config, |
| 230 const PersistedData& metadata) { | 230 PersistedData* metadata) { |
| 231 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 231 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool CheckForUpdates( | 234 bool CheckForUpdates( |
| 235 const std::vector<CrxUpdateItem*>& items_to_check, | 235 const std::vector<CrxUpdateItem*>& items_to_check, |
| 236 const std::string& additional_attributes, | 236 const std::string& additional_attributes, |
| 237 const UpdateCheckCallback& update_check_callback) override { | 237 const UpdateCheckCallback& update_check_callback) override { |
| 238 base::ThreadTaskRunnerHandle::Get()->PostTask( | 238 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 239 FROM_HERE, | 239 FROM_HERE, |
| 240 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 240 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 static void Callback(const base::Closure& quit_closure, int error) { | 327 static void Callback(const base::Closure& quit_closure, int error) { |
| 328 EXPECT_EQ(0, error); | 328 EXPECT_EQ(0, error); |
| 329 quit_closure.Run(); | 329 quit_closure.Run(); |
| 330 } | 330 } |
| 331 }; | 331 }; |
| 332 | 332 |
| 333 class FakeUpdateChecker : public UpdateChecker { | 333 class FakeUpdateChecker : public UpdateChecker { |
| 334 public: | 334 public: |
| 335 static scoped_ptr<UpdateChecker> Create( | 335 static scoped_ptr<UpdateChecker> Create( |
| 336 const scoped_refptr<Configurator>& config, | 336 const scoped_refptr<Configurator>& config, |
| 337 const PersistedData& metadata) { | 337 PersistedData* metadata) { |
| 338 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 338 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool CheckForUpdates( | 341 bool CheckForUpdates( |
| 342 const std::vector<CrxUpdateItem*>& items_to_check, | 342 const std::vector<CrxUpdateItem*>& items_to_check, |
| 343 const std::string& additional_attributes, | 343 const std::string& additional_attributes, |
| 344 const UpdateCheckCallback& update_check_callback) override { | 344 const UpdateCheckCallback& update_check_callback) override { |
| 345 /* | 345 /* |
| 346 Fake the following response: | 346 Fake the following response: |
| 347 | 347 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 static void Callback(const base::Closure& quit_closure, int error) { | 513 static void Callback(const base::Closure& quit_closure, int error) { |
| 514 EXPECT_EQ(0, error); | 514 EXPECT_EQ(0, error); |
| 515 quit_closure.Run(); | 515 quit_closure.Run(); |
| 516 } | 516 } |
| 517 }; | 517 }; |
| 518 | 518 |
| 519 class FakeUpdateChecker : public UpdateChecker { | 519 class FakeUpdateChecker : public UpdateChecker { |
| 520 public: | 520 public: |
| 521 static scoped_ptr<UpdateChecker> Create( | 521 static scoped_ptr<UpdateChecker> Create( |
| 522 const scoped_refptr<Configurator>& config, | 522 const scoped_refptr<Configurator>& config, |
| 523 const PersistedData& metadata) { | 523 PersistedData* metadata) { |
| 524 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 524 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 525 } | 525 } |
| 526 | 526 |
| 527 bool CheckForUpdates( | 527 bool CheckForUpdates( |
| 528 const std::vector<CrxUpdateItem*>& items_to_check, | 528 const std::vector<CrxUpdateItem*>& items_to_check, |
| 529 const std::string& additional_attributes, | 529 const std::string& additional_attributes, |
| 530 const UpdateCheckCallback& update_check_callback) override { | 530 const UpdateCheckCallback& update_check_callback) override { |
| 531 /* | 531 /* |
| 532 Fake the following response: | 532 Fake the following response: |
| 533 | 533 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 static void Callback(const base::Closure& quit_closure, int error) { | 761 static void Callback(const base::Closure& quit_closure, int error) { |
| 762 EXPECT_EQ(0, error); | 762 EXPECT_EQ(0, error); |
| 763 quit_closure.Run(); | 763 quit_closure.Run(); |
| 764 } | 764 } |
| 765 }; | 765 }; |
| 766 | 766 |
| 767 class FakeUpdateChecker : public UpdateChecker { | 767 class FakeUpdateChecker : public UpdateChecker { |
| 768 public: | 768 public: |
| 769 static scoped_ptr<UpdateChecker> Create( | 769 static scoped_ptr<UpdateChecker> Create( |
| 770 const scoped_refptr<Configurator>& config, | 770 const scoped_refptr<Configurator>& config, |
| 771 const PersistedData& metadata) { | 771 PersistedData* metadata) { |
| 772 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 772 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 773 } | 773 } |
| 774 | 774 |
| 775 bool CheckForUpdates( | 775 bool CheckForUpdates( |
| 776 const std::vector<CrxUpdateItem*>& items_to_check, | 776 const std::vector<CrxUpdateItem*>& items_to_check, |
| 777 const std::string& additional_attributes, | 777 const std::string& additional_attributes, |
| 778 const UpdateCheckCallback& update_check_callback) override { | 778 const UpdateCheckCallback& update_check_callback) override { |
| 779 /* | 779 /* |
| 780 Fake the following response: | 780 Fake the following response: |
| 781 | 781 |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 static void Callback(const base::Closure& quit_closure, int error) { | 1012 static void Callback(const base::Closure& quit_closure, int error) { |
| 1013 EXPECT_EQ(0, error); | 1013 EXPECT_EQ(0, error); |
| 1014 quit_closure.Run(); | 1014 quit_closure.Run(); |
| 1015 } | 1015 } |
| 1016 }; | 1016 }; |
| 1017 | 1017 |
| 1018 class FakeUpdateChecker : public UpdateChecker { | 1018 class FakeUpdateChecker : public UpdateChecker { |
| 1019 public: | 1019 public: |
| 1020 static scoped_ptr<UpdateChecker> Create( | 1020 static scoped_ptr<UpdateChecker> Create( |
| 1021 const scoped_refptr<Configurator>& config, | 1021 const scoped_refptr<Configurator>& config, |
| 1022 const PersistedData& metadata) { | 1022 PersistedData* metadata) { |
| 1023 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1023 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 bool CheckForUpdates( | 1026 bool CheckForUpdates( |
| 1027 const std::vector<CrxUpdateItem*>& items_to_check, | 1027 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1028 const std::string& additional_attributes, | 1028 const std::string& additional_attributes, |
| 1029 const UpdateCheckCallback& update_check_callback) override { | 1029 const UpdateCheckCallback& update_check_callback) override { |
| 1030 static int num_call = 0; | 1030 static int num_call = 0; |
| 1031 ++num_call; | 1031 ++num_call; |
| 1032 | 1032 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 static void Callback(const base::Closure& quit_closure, int error) { | 1304 static void Callback(const base::Closure& quit_closure, int error) { |
| 1305 EXPECT_EQ(0, error); | 1305 EXPECT_EQ(0, error); |
| 1306 quit_closure.Run(); | 1306 quit_closure.Run(); |
| 1307 } | 1307 } |
| 1308 }; | 1308 }; |
| 1309 | 1309 |
| 1310 class FakeUpdateChecker : public UpdateChecker { | 1310 class FakeUpdateChecker : public UpdateChecker { |
| 1311 public: | 1311 public: |
| 1312 static scoped_ptr<UpdateChecker> Create( | 1312 static scoped_ptr<UpdateChecker> Create( |
| 1313 const scoped_refptr<Configurator>& config, | 1313 const scoped_refptr<Configurator>& config, |
| 1314 const PersistedData& metadata) { | 1314 PersistedData* metadata) { |
| 1315 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1315 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 bool CheckForUpdates( | 1318 bool CheckForUpdates( |
| 1319 const std::vector<CrxUpdateItem*>& items_to_check, | 1319 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1320 const std::string& additional_attributes, | 1320 const std::string& additional_attributes, |
| 1321 const UpdateCheckCallback& update_check_callback) override { | 1321 const UpdateCheckCallback& update_check_callback) override { |
| 1322 /* | 1322 /* |
| 1323 Fake the following response: | 1323 Fake the following response: |
| 1324 | 1324 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 static void Callback(const base::Closure& quit_closure, int error) { | 1488 static void Callback(const base::Closure& quit_closure, int error) { |
| 1489 EXPECT_EQ(0, error); | 1489 EXPECT_EQ(0, error); |
| 1490 quit_closure.Run(); | 1490 quit_closure.Run(); |
| 1491 } | 1491 } |
| 1492 }; | 1492 }; |
| 1493 | 1493 |
| 1494 class FakeUpdateChecker : public UpdateChecker { | 1494 class FakeUpdateChecker : public UpdateChecker { |
| 1495 public: | 1495 public: |
| 1496 static scoped_ptr<UpdateChecker> Create( | 1496 static scoped_ptr<UpdateChecker> Create( |
| 1497 const scoped_refptr<Configurator>& config, | 1497 const scoped_refptr<Configurator>& config, |
| 1498 const PersistedData& metadata) { | 1498 PersistedData* metadata) { |
| 1499 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1499 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1500 } | 1500 } |
| 1501 | 1501 |
| 1502 bool CheckForUpdates( | 1502 bool CheckForUpdates( |
| 1503 const std::vector<CrxUpdateItem*>& items_to_check, | 1503 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1504 const std::string& additional_attributes, | 1504 const std::string& additional_attributes, |
| 1505 const UpdateCheckCallback& update_check_callback) override { | 1505 const UpdateCheckCallback& update_check_callback) override { |
| 1506 static int num_call = 0; | 1506 static int num_call = 0; |
| 1507 ++num_call; | 1507 ++num_call; |
| 1508 | 1508 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 | 1778 |
| 1779 if (num_call == 2) | 1779 if (num_call == 2) |
| 1780 quit_closure.Run(); | 1780 quit_closure.Run(); |
| 1781 } | 1781 } |
| 1782 }; | 1782 }; |
| 1783 | 1783 |
| 1784 class FakeUpdateChecker : public UpdateChecker { | 1784 class FakeUpdateChecker : public UpdateChecker { |
| 1785 public: | 1785 public: |
| 1786 static scoped_ptr<UpdateChecker> Create( | 1786 static scoped_ptr<UpdateChecker> Create( |
| 1787 const scoped_refptr<Configurator>& config, | 1787 const scoped_refptr<Configurator>& config, |
| 1788 const PersistedData& metadata) { | 1788 PersistedData* metadata) { |
| 1789 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1789 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 bool CheckForUpdates( | 1792 bool CheckForUpdates( |
| 1793 const std::vector<CrxUpdateItem*>& items_to_check, | 1793 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1794 const std::string& additional_attributes, | 1794 const std::string& additional_attributes, |
| 1795 const UpdateCheckCallback& update_check_callback) override { | 1795 const UpdateCheckCallback& update_check_callback) override { |
| 1796 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1796 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1797 FROM_HERE, | 1797 FROM_HERE, |
| 1798 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 1798 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 static void Callback(const base::Closure& quit_closure, int error) { | 1878 static void Callback(const base::Closure& quit_closure, int error) { |
| 1879 EXPECT_EQ(0, error); | 1879 EXPECT_EQ(0, error); |
| 1880 quit_closure.Run(); | 1880 quit_closure.Run(); |
| 1881 } | 1881 } |
| 1882 }; | 1882 }; |
| 1883 | 1883 |
| 1884 class FakeUpdateChecker : public UpdateChecker { | 1884 class FakeUpdateChecker : public UpdateChecker { |
| 1885 public: | 1885 public: |
| 1886 static scoped_ptr<UpdateChecker> Create( | 1886 static scoped_ptr<UpdateChecker> Create( |
| 1887 const scoped_refptr<Configurator>& config, | 1887 const scoped_refptr<Configurator>& config, |
| 1888 const PersistedData& metadata) { | 1888 PersistedData* metadata) { |
| 1889 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1889 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1890 } | 1890 } |
| 1891 | 1891 |
| 1892 bool CheckForUpdates( | 1892 bool CheckForUpdates( |
| 1893 const std::vector<CrxUpdateItem*>& items_to_check, | 1893 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1894 const std::string& additional_attributes, | 1894 const std::string& additional_attributes, |
| 1895 const UpdateCheckCallback& update_check_callback) override { | 1895 const UpdateCheckCallback& update_check_callback) override { |
| 1896 /* | 1896 /* |
| 1897 Fake the following response: | 1897 Fake the following response: |
| 1898 | 1898 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 EXPECT_EQ(0, error); | 2065 EXPECT_EQ(0, error); |
| 2066 quit_closure.Run(); | 2066 quit_closure.Run(); |
| 2067 } | 2067 } |
| 2068 } | 2068 } |
| 2069 }; | 2069 }; |
| 2070 | 2070 |
| 2071 class FakeUpdateChecker : public UpdateChecker { | 2071 class FakeUpdateChecker : public UpdateChecker { |
| 2072 public: | 2072 public: |
| 2073 static scoped_ptr<UpdateChecker> Create( | 2073 static scoped_ptr<UpdateChecker> Create( |
| 2074 const scoped_refptr<Configurator>& config, | 2074 const scoped_refptr<Configurator>& config, |
| 2075 const PersistedData& metadata) { | 2075 PersistedData* metadata) { |
| 2076 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2076 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2077 } | 2077 } |
| 2078 | 2078 |
| 2079 bool CheckForUpdates( | 2079 bool CheckForUpdates( |
| 2080 const std::vector<CrxUpdateItem*>& items_to_check, | 2080 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2081 const std::string& additional_attributes, | 2081 const std::string& additional_attributes, |
| 2082 const UpdateCheckCallback& update_check_callback) override { | 2082 const UpdateCheckCallback& update_check_callback) override { |
| 2083 base::ThreadTaskRunnerHandle::Get()->PostTask( | 2083 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 2084 FROM_HERE, | 2084 FROM_HERE, |
| 2085 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 2085 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2159 class CompletionCallbackFake { | 2159 class CompletionCallbackFake { |
| 2160 public: | 2160 public: |
| 2161 static void Callback(const base::Closure& quit_closure, int error) { | 2161 static void Callback(const base::Closure& quit_closure, int error) { |
| 2162 quit_closure.Run(); | 2162 quit_closure.Run(); |
| 2163 } | 2163 } |
| 2164 }; | 2164 }; |
| 2165 class FakeUpdateChecker : public UpdateChecker { | 2165 class FakeUpdateChecker : public UpdateChecker { |
| 2166 public: | 2166 public: |
| 2167 static scoped_ptr<UpdateChecker> Create( | 2167 static scoped_ptr<UpdateChecker> Create( |
| 2168 const scoped_refptr<Configurator>& config, | 2168 const scoped_refptr<Configurator>& config, |
| 2169 const PersistedData& metadata) { | 2169 PersistedData* metadata) { |
| 2170 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2170 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 bool CheckForUpdates( | 2173 bool CheckForUpdates( |
| 2174 const std::vector<CrxUpdateItem*>& items_to_check, | 2174 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2175 const std::string& additional_attributes, | 2175 const std::string& additional_attributes, |
| 2176 const UpdateCheckCallback& update_check_callback) override { | 2176 const UpdateCheckCallback& update_check_callback) override { |
| 2177 return false; | 2177 return false; |
| 2178 } | 2178 } |
| 2179 }; | 2179 }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2205 empty_id_list, base::Bind(&DataCallbackFake::Callback), | 2205 empty_id_list, base::Bind(&DataCallbackFake::Callback), |
| 2206 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); | 2206 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); |
| 2207 runloop.Run(); | 2207 runloop.Run(); |
| 2208 } | 2208 } |
| 2209 | 2209 |
| 2210 TEST_F(UpdateClientTest, SendUninstallPing) { | 2210 TEST_F(UpdateClientTest, SendUninstallPing) { |
| 2211 class FakeUpdateChecker : public UpdateChecker { | 2211 class FakeUpdateChecker : public UpdateChecker { |
| 2212 public: | 2212 public: |
| 2213 static scoped_ptr<UpdateChecker> Create( | 2213 static scoped_ptr<UpdateChecker> Create( |
| 2214 const scoped_refptr<Configurator>& config, | 2214 const scoped_refptr<Configurator>& config, |
| 2215 const PersistedData& metadata) { | 2215 PersistedData* metadata) { |
| 2216 return nullptr; | 2216 return nullptr; |
| 2217 } | 2217 } |
| 2218 | 2218 |
| 2219 bool CheckForUpdates( | 2219 bool CheckForUpdates( |
| 2220 const std::vector<CrxUpdateItem*>& items_to_check, | 2220 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2221 const std::string& additional_attributes, | 2221 const std::string& additional_attributes, |
| 2222 const UpdateCheckCallback& update_check_callback) override { | 2222 const UpdateCheckCallback& update_check_callback) override { |
| 2223 return false; | 2223 return false; |
| 2224 } | 2224 } |
| 2225 }; | 2225 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 quit_closure.Run(); | 2305 quit_closure.Run(); |
| 2306 } | 2306 } |
| 2307 }; | 2307 }; |
| 2308 | 2308 |
| 2309 class FakeUpdateChecker : public UpdateChecker { | 2309 class FakeUpdateChecker : public UpdateChecker { |
| 2310 public: | 2310 public: |
| 2311 static scoped_ptr<UpdateChecker> Create( | 2311 static scoped_ptr<UpdateChecker> Create( |
| 2312 const scoped_refptr<Configurator>& config, | 2312 const scoped_refptr<Configurator>& config, |
| 2313 const PersistedData& metadata) { | 2313 PersistedData* metadata) { |
| 2314 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2314 return scoped_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2315 } | 2315 } |
| 2316 | 2316 |
| 2317 bool CheckForUpdates( | 2317 bool CheckForUpdates( |
| 2318 const std::vector<CrxUpdateItem*>& items_to_check, | 2318 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2319 const std::string& additional_attributes, | 2319 const std::string& additional_attributes, |
| 2320 const UpdateCheckCallback& update_check_callback) override { | 2320 const UpdateCheckCallback& update_check_callback) override { |
| 2321 static int num_call = 0; | 2321 static int num_call = 0; |
| 2322 ++num_call; | 2322 ++num_call; |
| 2323 | 2323 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 update_client->Update( | 2429 update_client->Update( |
| 2430 ids, base::Bind(&DataCallbackFake::Callback), | 2430 ids, base::Bind(&DataCallbackFake::Callback), |
| 2431 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); | 2431 base::Bind(&CompletionCallbackFake::Callback, runloop.QuitClosure())); |
| 2432 runloop.Run(); | 2432 runloop.Run(); |
| 2433 } | 2433 } |
| 2434 | 2434 |
| 2435 update_client->RemoveObserver(&observer); | 2435 update_client->RemoveObserver(&observer); |
| 2436 } | 2436 } |
| 2437 | 2437 |
| 2438 } // namespace update_client | 2438 } // namespace update_client |
| OLD | NEW |