| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 public: | 228 public: |
| 229 static std::unique_ptr<UpdateChecker> Create( | 229 static std::unique_ptr<UpdateChecker> Create( |
| 230 const scoped_refptr<Configurator>& config, | 230 const scoped_refptr<Configurator>& config, |
| 231 PersistedData* metadata) { | 231 PersistedData* metadata) { |
| 232 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 232 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 bool CheckForUpdates( | 235 bool CheckForUpdates( |
| 236 const std::vector<CrxUpdateItem*>& items_to_check, | 236 const std::vector<CrxUpdateItem*>& items_to_check, |
| 237 const std::string& additional_attributes, | 237 const std::string& additional_attributes, |
| 238 bool enabled_component_updates, |
| 238 const UpdateCheckCallback& update_check_callback) override { | 239 const UpdateCheckCallback& update_check_callback) override { |
| 240 EXPECT_TRUE(enabled_component_updates); |
| 239 base::ThreadTaskRunnerHandle::Get()->PostTask( | 241 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 240 FROM_HERE, | 242 FROM_HERE, |
| 241 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 243 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| 242 return true; | 244 return true; |
| 243 } | 245 } |
| 244 }; | 246 }; |
| 245 | 247 |
| 246 class FakeCrxDownloader : public CrxDownloader { | 248 class FakeCrxDownloader : public CrxDownloader { |
| 247 public: | 249 public: |
| 248 static std::unique_ptr<CrxDownloader> Create( | 250 static std::unique_ptr<CrxDownloader> Create( |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 public: | 337 public: |
| 336 static std::unique_ptr<UpdateChecker> Create( | 338 static std::unique_ptr<UpdateChecker> Create( |
| 337 const scoped_refptr<Configurator>& config, | 339 const scoped_refptr<Configurator>& config, |
| 338 PersistedData* metadata) { | 340 PersistedData* metadata) { |
| 339 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 341 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 340 } | 342 } |
| 341 | 343 |
| 342 bool CheckForUpdates( | 344 bool CheckForUpdates( |
| 343 const std::vector<CrxUpdateItem*>& items_to_check, | 345 const std::vector<CrxUpdateItem*>& items_to_check, |
| 344 const std::string& additional_attributes, | 346 const std::string& additional_attributes, |
| 347 bool enabled_component_updates, |
| 345 const UpdateCheckCallback& update_check_callback) override { | 348 const UpdateCheckCallback& update_check_callback) override { |
| 346 /* | 349 /* |
| 347 Fake the following response: | 350 Fake the following response: |
| 348 | 351 |
| 349 <?xml version='1.0' encoding='UTF-8'?> | 352 <?xml version='1.0' encoding='UTF-8'?> |
| 350 <response protocol='3.0'> | 353 <response protocol='3.0'> |
| 351 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 354 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 352 <updatecheck status='ok'> | 355 <updatecheck status='ok'> |
| 353 <urls> | 356 <urls> |
| 354 <url codebase='http://localhost/download/'/> | 357 <url codebase='http://localhost/download/'/> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 public: | 524 public: |
| 522 static std::unique_ptr<UpdateChecker> Create( | 525 static std::unique_ptr<UpdateChecker> Create( |
| 523 const scoped_refptr<Configurator>& config, | 526 const scoped_refptr<Configurator>& config, |
| 524 PersistedData* metadata) { | 527 PersistedData* metadata) { |
| 525 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 528 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 526 } | 529 } |
| 527 | 530 |
| 528 bool CheckForUpdates( | 531 bool CheckForUpdates( |
| 529 const std::vector<CrxUpdateItem*>& items_to_check, | 532 const std::vector<CrxUpdateItem*>& items_to_check, |
| 530 const std::string& additional_attributes, | 533 const std::string& additional_attributes, |
| 534 bool enabled_component_updates, |
| 531 const UpdateCheckCallback& update_check_callback) override { | 535 const UpdateCheckCallback& update_check_callback) override { |
| 532 /* | 536 /* |
| 533 Fake the following response: | 537 Fake the following response: |
| 534 | 538 |
| 535 <?xml version='1.0' encoding='UTF-8'?> | 539 <?xml version='1.0' encoding='UTF-8'?> |
| 536 <response protocol='3.0'> | 540 <response protocol='3.0'> |
| 537 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 541 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 538 <updatecheck status='ok'> | 542 <updatecheck status='ok'> |
| 539 <urls> | 543 <urls> |
| 540 <url codebase='http://localhost/download/'/> | 544 <url codebase='http://localhost/download/'/> |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 public: | 773 public: |
| 770 static std::unique_ptr<UpdateChecker> Create( | 774 static std::unique_ptr<UpdateChecker> Create( |
| 771 const scoped_refptr<Configurator>& config, | 775 const scoped_refptr<Configurator>& config, |
| 772 PersistedData* metadata) { | 776 PersistedData* metadata) { |
| 773 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 777 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 774 } | 778 } |
| 775 | 779 |
| 776 bool CheckForUpdates( | 780 bool CheckForUpdates( |
| 777 const std::vector<CrxUpdateItem*>& items_to_check, | 781 const std::vector<CrxUpdateItem*>& items_to_check, |
| 778 const std::string& additional_attributes, | 782 const std::string& additional_attributes, |
| 783 bool enabled_component_updates, |
| 779 const UpdateCheckCallback& update_check_callback) override { | 784 const UpdateCheckCallback& update_check_callback) override { |
| 780 /* | 785 /* |
| 781 Fake the following response: | 786 Fake the following response: |
| 782 | 787 |
| 783 <?xml version='1.0' encoding='UTF-8'?> | 788 <?xml version='1.0' encoding='UTF-8'?> |
| 784 <response protocol='3.0'> | 789 <response protocol='3.0'> |
| 785 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 790 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 786 <updatecheck status='ok'> | 791 <updatecheck status='ok'> |
| 787 <urls> | 792 <urls> |
| 788 <url codebase='http://localhost/download/'/> | 793 <url codebase='http://localhost/download/'/> |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 public: | 1025 public: |
| 1021 static std::unique_ptr<UpdateChecker> Create( | 1026 static std::unique_ptr<UpdateChecker> Create( |
| 1022 const scoped_refptr<Configurator>& config, | 1027 const scoped_refptr<Configurator>& config, |
| 1023 PersistedData* metadata) { | 1028 PersistedData* metadata) { |
| 1024 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1029 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1025 } | 1030 } |
| 1026 | 1031 |
| 1027 bool CheckForUpdates( | 1032 bool CheckForUpdates( |
| 1028 const std::vector<CrxUpdateItem*>& items_to_check, | 1033 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1029 const std::string& additional_attributes, | 1034 const std::string& additional_attributes, |
| 1035 bool enabled_component_updates, |
| 1030 const UpdateCheckCallback& update_check_callback) override { | 1036 const UpdateCheckCallback& update_check_callback) override { |
| 1031 static int num_call = 0; | 1037 static int num_call = 0; |
| 1032 ++num_call; | 1038 ++num_call; |
| 1033 | 1039 |
| 1034 UpdateResponse::Results results; | 1040 UpdateResponse::Results results; |
| 1035 | 1041 |
| 1036 if (num_call == 1) { | 1042 if (num_call == 1) { |
| 1037 /* | 1043 /* |
| 1038 Fake the following response: | 1044 Fake the following response: |
| 1039 <?xml version='1.0' encoding='UTF-8'?> | 1045 <?xml version='1.0' encoding='UTF-8'?> |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1312 public: | 1318 public: |
| 1313 static std::unique_ptr<UpdateChecker> Create( | 1319 static std::unique_ptr<UpdateChecker> Create( |
| 1314 const scoped_refptr<Configurator>& config, | 1320 const scoped_refptr<Configurator>& config, |
| 1315 PersistedData* metadata) { | 1321 PersistedData* metadata) { |
| 1316 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1322 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1317 } | 1323 } |
| 1318 | 1324 |
| 1319 bool CheckForUpdates( | 1325 bool CheckForUpdates( |
| 1320 const std::vector<CrxUpdateItem*>& items_to_check, | 1326 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1321 const std::string& additional_attributes, | 1327 const std::string& additional_attributes, |
| 1328 bool enabled_component_updates, |
| 1322 const UpdateCheckCallback& update_check_callback) override { | 1329 const UpdateCheckCallback& update_check_callback) override { |
| 1323 /* | 1330 /* |
| 1324 Fake the following response: | 1331 Fake the following response: |
| 1325 | 1332 |
| 1326 <?xml version='1.0' encoding='UTF-8'?> | 1333 <?xml version='1.0' encoding='UTF-8'?> |
| 1327 <response protocol='3.0'> | 1334 <response protocol='3.0'> |
| 1328 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 1335 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 1329 <updatecheck status='ok'> | 1336 <updatecheck status='ok'> |
| 1330 <urls> | 1337 <urls> |
| 1331 <url codebase='http://localhost/download/'/> | 1338 <url codebase='http://localhost/download/'/> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 public: | 1503 public: |
| 1497 static std::unique_ptr<UpdateChecker> Create( | 1504 static std::unique_ptr<UpdateChecker> Create( |
| 1498 const scoped_refptr<Configurator>& config, | 1505 const scoped_refptr<Configurator>& config, |
| 1499 PersistedData* metadata) { | 1506 PersistedData* metadata) { |
| 1500 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1507 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1501 } | 1508 } |
| 1502 | 1509 |
| 1503 bool CheckForUpdates( | 1510 bool CheckForUpdates( |
| 1504 const std::vector<CrxUpdateItem*>& items_to_check, | 1511 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1505 const std::string& additional_attributes, | 1512 const std::string& additional_attributes, |
| 1513 bool enabled_component_updates, |
| 1506 const UpdateCheckCallback& update_check_callback) override { | 1514 const UpdateCheckCallback& update_check_callback) override { |
| 1507 static int num_call = 0; | 1515 static int num_call = 0; |
| 1508 ++num_call; | 1516 ++num_call; |
| 1509 | 1517 |
| 1510 UpdateResponse::Results results; | 1518 UpdateResponse::Results results; |
| 1511 | 1519 |
| 1512 if (num_call == 1) { | 1520 if (num_call == 1) { |
| 1513 /* | 1521 /* |
| 1514 Fake the following response: | 1522 Fake the following response: |
| 1515 <?xml version='1.0' encoding='UTF-8'?> | 1523 <?xml version='1.0' encoding='UTF-8'?> |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 public: | 1794 public: |
| 1787 static std::unique_ptr<UpdateChecker> Create( | 1795 static std::unique_ptr<UpdateChecker> Create( |
| 1788 const scoped_refptr<Configurator>& config, | 1796 const scoped_refptr<Configurator>& config, |
| 1789 PersistedData* metadata) { | 1797 PersistedData* metadata) { |
| 1790 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1798 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1791 } | 1799 } |
| 1792 | 1800 |
| 1793 bool CheckForUpdates( | 1801 bool CheckForUpdates( |
| 1794 const std::vector<CrxUpdateItem*>& items_to_check, | 1802 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1795 const std::string& additional_attributes, | 1803 const std::string& additional_attributes, |
| 1804 bool enabled_component_updates, |
| 1796 const UpdateCheckCallback& update_check_callback) override { | 1805 const UpdateCheckCallback& update_check_callback) override { |
| 1797 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1806 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1798 FROM_HERE, | 1807 FROM_HERE, |
| 1799 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 1808 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| 1800 return true; | 1809 return true; |
| 1801 } | 1810 } |
| 1802 }; | 1811 }; |
| 1803 | 1812 |
| 1804 class FakeCrxDownloader : public CrxDownloader { | 1813 class FakeCrxDownloader : public CrxDownloader { |
| 1805 public: | 1814 public: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 public: | 1895 public: |
| 1887 static std::unique_ptr<UpdateChecker> Create( | 1896 static std::unique_ptr<UpdateChecker> Create( |
| 1888 const scoped_refptr<Configurator>& config, | 1897 const scoped_refptr<Configurator>& config, |
| 1889 PersistedData* metadata) { | 1898 PersistedData* metadata) { |
| 1890 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 1899 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 1891 } | 1900 } |
| 1892 | 1901 |
| 1893 bool CheckForUpdates( | 1902 bool CheckForUpdates( |
| 1894 const std::vector<CrxUpdateItem*>& items_to_check, | 1903 const std::vector<CrxUpdateItem*>& items_to_check, |
| 1895 const std::string& additional_attributes, | 1904 const std::string& additional_attributes, |
| 1905 bool enabled_component_updates, |
| 1896 const UpdateCheckCallback& update_check_callback) override { | 1906 const UpdateCheckCallback& update_check_callback) override { |
| 1897 /* | 1907 /* |
| 1898 Fake the following response: | 1908 Fake the following response: |
| 1899 | 1909 |
| 1900 <?xml version='1.0' encoding='UTF-8'?> | 1910 <?xml version='1.0' encoding='UTF-8'?> |
| 1901 <response protocol='3.0'> | 1911 <response protocol='3.0'> |
| 1902 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 1912 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 1903 <updatecheck status='ok'> | 1913 <updatecheck status='ok'> |
| 1904 <urls> | 1914 <urls> |
| 1905 <url codebase='http://localhost/download/'/> | 1915 <url codebase='http://localhost/download/'/> |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 public: | 2083 public: |
| 2074 static std::unique_ptr<UpdateChecker> Create( | 2084 static std::unique_ptr<UpdateChecker> Create( |
| 2075 const scoped_refptr<Configurator>& config, | 2085 const scoped_refptr<Configurator>& config, |
| 2076 PersistedData* metadata) { | 2086 PersistedData* metadata) { |
| 2077 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2087 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2078 } | 2088 } |
| 2079 | 2089 |
| 2080 bool CheckForUpdates( | 2090 bool CheckForUpdates( |
| 2081 const std::vector<CrxUpdateItem*>& items_to_check, | 2091 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2082 const std::string& additional_attributes, | 2092 const std::string& additional_attributes, |
| 2093 bool enabled_component_updates, |
| 2083 const UpdateCheckCallback& update_check_callback) override { | 2094 const UpdateCheckCallback& update_check_callback) override { |
| 2084 base::ThreadTaskRunnerHandle::Get()->PostTask( | 2095 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 2085 FROM_HERE, | 2096 FROM_HERE, |
| 2086 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); | 2097 base::Bind(update_check_callback, 0, UpdateResponse::Results(), 0)); |
| 2087 return true; | 2098 return true; |
| 2088 } | 2099 } |
| 2089 }; | 2100 }; |
| 2090 | 2101 |
| 2091 class FakeCrxDownloader : public CrxDownloader { | 2102 class FakeCrxDownloader : public CrxDownloader { |
| 2092 public: | 2103 public: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2167 public: | 2178 public: |
| 2168 static std::unique_ptr<UpdateChecker> Create( | 2179 static std::unique_ptr<UpdateChecker> Create( |
| 2169 const scoped_refptr<Configurator>& config, | 2180 const scoped_refptr<Configurator>& config, |
| 2170 PersistedData* metadata) { | 2181 PersistedData* metadata) { |
| 2171 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2182 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2172 } | 2183 } |
| 2173 | 2184 |
| 2174 bool CheckForUpdates( | 2185 bool CheckForUpdates( |
| 2175 const std::vector<CrxUpdateItem*>& items_to_check, | 2186 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2176 const std::string& additional_attributes, | 2187 const std::string& additional_attributes, |
| 2188 bool enabled_component_updates, |
| 2177 const UpdateCheckCallback& update_check_callback) override { | 2189 const UpdateCheckCallback& update_check_callback) override { |
| 2178 return false; | 2190 return false; |
| 2179 } | 2191 } |
| 2180 }; | 2192 }; |
| 2181 | 2193 |
| 2182 class FakeCrxDownloader : public CrxDownloader { | 2194 class FakeCrxDownloader : public CrxDownloader { |
| 2183 public: | 2195 public: |
| 2184 static std::unique_ptr<CrxDownloader> Create( | 2196 static std::unique_ptr<CrxDownloader> Create( |
| 2185 bool is_background_download, | 2197 bool is_background_download, |
| 2186 net::URLRequestContextGetter* context_getter, | 2198 net::URLRequestContextGetter* context_getter, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2213 public: | 2225 public: |
| 2214 static std::unique_ptr<UpdateChecker> Create( | 2226 static std::unique_ptr<UpdateChecker> Create( |
| 2215 const scoped_refptr<Configurator>& config, | 2227 const scoped_refptr<Configurator>& config, |
| 2216 PersistedData* metadata) { | 2228 PersistedData* metadata) { |
| 2217 return nullptr; | 2229 return nullptr; |
| 2218 } | 2230 } |
| 2219 | 2231 |
| 2220 bool CheckForUpdates( | 2232 bool CheckForUpdates( |
| 2221 const std::vector<CrxUpdateItem*>& items_to_check, | 2233 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2222 const std::string& additional_attributes, | 2234 const std::string& additional_attributes, |
| 2235 bool enabled_component_updates, |
| 2223 const UpdateCheckCallback& update_check_callback) override { | 2236 const UpdateCheckCallback& update_check_callback) override { |
| 2224 return false; | 2237 return false; |
| 2225 } | 2238 } |
| 2226 }; | 2239 }; |
| 2227 | 2240 |
| 2228 class FakeCrxDownloader : public CrxDownloader { | 2241 class FakeCrxDownloader : public CrxDownloader { |
| 2229 public: | 2242 public: |
| 2230 static std::unique_ptr<CrxDownloader> Create( | 2243 static std::unique_ptr<CrxDownloader> Create( |
| 2231 bool is_background_download, | 2244 bool is_background_download, |
| 2232 net::URLRequestContextGetter* context_getter, | 2245 net::URLRequestContextGetter* context_getter, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2311 public: | 2324 public: |
| 2312 static std::unique_ptr<UpdateChecker> Create( | 2325 static std::unique_ptr<UpdateChecker> Create( |
| 2313 const scoped_refptr<Configurator>& config, | 2326 const scoped_refptr<Configurator>& config, |
| 2314 PersistedData* metadata) { | 2327 PersistedData* metadata) { |
| 2315 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2328 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2316 } | 2329 } |
| 2317 | 2330 |
| 2318 bool CheckForUpdates( | 2331 bool CheckForUpdates( |
| 2319 const std::vector<CrxUpdateItem*>& items_to_check, | 2332 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2320 const std::string& additional_attributes, | 2333 const std::string& additional_attributes, |
| 2334 bool enabled_component_updates, |
| 2321 const UpdateCheckCallback& update_check_callback) override { | 2335 const UpdateCheckCallback& update_check_callback) override { |
| 2322 static int num_call = 0; | 2336 static int num_call = 0; |
| 2323 ++num_call; | 2337 ++num_call; |
| 2324 | 2338 |
| 2325 EXPECT_LE(num_call, 3); | 2339 EXPECT_LE(num_call, 3); |
| 2326 | 2340 |
| 2327 int retry_after_sec(0); | 2341 int retry_after_sec(0); |
| 2328 if (num_call == 1) { | 2342 if (num_call == 1) { |
| 2329 // Throttle the next call. | 2343 // Throttle the next call. |
| 2330 retry_after_sec = 60 * 60; // 1 hour. | 2344 retry_after_sec = 60 * 60; // 1 hour. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2475 public: | 2489 public: |
| 2476 static std::unique_ptr<UpdateChecker> Create( | 2490 static std::unique_ptr<UpdateChecker> Create( |
| 2477 const scoped_refptr<Configurator>& config, | 2491 const scoped_refptr<Configurator>& config, |
| 2478 PersistedData* metadata) { | 2492 PersistedData* metadata) { |
| 2479 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); | 2493 return std::unique_ptr<UpdateChecker>(new FakeUpdateChecker()); |
| 2480 } | 2494 } |
| 2481 | 2495 |
| 2482 bool CheckForUpdates( | 2496 bool CheckForUpdates( |
| 2483 const std::vector<CrxUpdateItem*>& items_to_check, | 2497 const std::vector<CrxUpdateItem*>& items_to_check, |
| 2484 const std::string& additional_attributes, | 2498 const std::string& additional_attributes, |
| 2499 bool enabled_component_updates, |
| 2485 const UpdateCheckCallback& update_check_callback) override { | 2500 const UpdateCheckCallback& update_check_callback) override { |
| 2486 /* | 2501 /* |
| 2487 Fake the following response: | 2502 Fake the following response: |
| 2488 | 2503 |
| 2489 <?xml version='1.0' encoding='UTF-8'?> | 2504 <?xml version='1.0' encoding='UTF-8'?> |
| 2490 <response protocol='3.0'> | 2505 <response protocol='3.0'> |
| 2491 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> | 2506 <app appid='jebgalgnebhfojomionfpkfelancnnkf'> |
| 2492 <updatecheck status='ok'> | 2507 <updatecheck status='ok'> |
| 2493 <urls> | 2508 <urls> |
| 2494 <url codebase='http://localhost/download/'/> | 2509 <url codebase='http://localhost/download/'/> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2511 <packages> | 2526 <packages> |
| 2512 <package name='ihfokbkgjpifnbbojhneepfflplebdkc_1.crx' | 2527 <package name='ihfokbkgjpifnbbojhneepfflplebdkc_1.crx' |
| 2513 hash_sha256='813c59747e139a608b3b5fc49633affc6db574373f | 2528 hash_sha256='813c59747e139a608b3b5fc49633affc6db574373f |
| 2514 309f156ea6d27229c0b3f9'/> | 2529 309f156ea6d27229c0b3f9'/> |
| 2515 </packages> | 2530 </packages> |
| 2516 </manifest> | 2531 </manifest> |
| 2517 </updatecheck> | 2532 </updatecheck> |
| 2518 </app> | 2533 </app> |
| 2519 </response> | 2534 </response> |
| 2520 */ | 2535 */ |
| 2536 |
| 2537 // UpdateClient reads the state of |enabled_component_updates| from the |
| 2538 // configurator instance, persists its value in the corresponding |
| 2539 // update context, and propagates it down to each of the update actions, |
| 2540 // and further down to the UpdateChecker instance. |
| 2541 EXPECT_FALSE(enabled_component_updates); |
| 2542 |
| 2521 UpdateResponse::Result::Manifest::Package package1; | 2543 UpdateResponse::Result::Manifest::Package package1; |
| 2522 package1.name = "jebgalgnebhfojomionfpkfelancnnkf.crx"; | 2544 package1.name = "jebgalgnebhfojomionfpkfelancnnkf.crx"; |
| 2523 package1.hash_sha256 = | 2545 package1.hash_sha256 = |
| 2524 "6fc4b93fd11134de1300c2c0bb88c12b644a4ec0fd7c9b12cb7cc067667bde87"; | 2546 "6fc4b93fd11134de1300c2c0bb88c12b644a4ec0fd7c9b12cb7cc067667bde87"; |
| 2525 | 2547 |
| 2526 UpdateResponse::Result result1; | 2548 UpdateResponse::Result result1; |
| 2527 result1.extension_id = "jebgalgnebhfojomionfpkfelancnnkf"; | 2549 result1.extension_id = "jebgalgnebhfojomionfpkfelancnnkf"; |
| 2528 result1.crx_urls.push_back(GURL("http://localhost/download/")); | 2550 result1.crx_urls.push_back(GURL("http://localhost/download/")); |
| 2529 result1.manifest.version = "1.0"; | 2551 result1.manifest.version = "1.0"; |
| 2530 result1.manifest.browser_min_version = "11.0.1.0"; | 2552 result1.manifest.browser_min_version = "11.0.1.0"; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2671 update_client->Update( | 2693 update_client->Update( |
| 2672 ids, base::Bind(&DataCallbackFake::Callback), | 2694 ids, base::Bind(&DataCallbackFake::Callback), |
| 2673 base::Bind(&CompletionCallbackFake::Callback, quit_closure())); | 2695 base::Bind(&CompletionCallbackFake::Callback, quit_closure())); |
| 2674 | 2696 |
| 2675 RunThreads(); | 2697 RunThreads(); |
| 2676 | 2698 |
| 2677 update_client->RemoveObserver(&observer); | 2699 update_client->RemoveObserver(&observer); |
| 2678 } | 2700 } |
| 2679 | 2701 |
| 2680 } // namespace update_client | 2702 } // namespace update_client |
| OLD | NEW |