| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public: | 31 public: |
| 32 FakeUpdateClient(); | 32 FakeUpdateClient(); |
| 33 | 33 |
| 34 // Returns the data we've gotten from the CrxDataCallback for ids passed to | 34 // Returns the data we've gotten from the CrxDataCallback for ids passed to |
| 35 // the Update function. | 35 // the Update function. |
| 36 std::vector<update_client::CrxComponent>* data() { return &data_; } | 36 std::vector<update_client::CrxComponent>* data() { return &data_; } |
| 37 | 37 |
| 38 // Used for tests that uninstall pings get requested properly. | 38 // Used for tests that uninstall pings get requested properly. |
| 39 struct UninstallPing { | 39 struct UninstallPing { |
| 40 std::string id; | 40 std::string id; |
| 41 Version version; | 41 base::Version version; |
| 42 int reason; | 42 int reason; |
| 43 UninstallPing(const std::string& id, const Version& version, int reason) | 43 UninstallPing(const std::string& id, |
| 44 const base::Version& version, |
| 45 int reason) |
| 44 : id(id), version(version), reason(reason) {} | 46 : id(id), version(version), reason(reason) {} |
| 45 }; | 47 }; |
| 46 std::vector<UninstallPing>& uninstall_pings() { return uninstall_pings_; } | 48 std::vector<UninstallPing>& uninstall_pings() { return uninstall_pings_; } |
| 47 | 49 |
| 48 // update_client::UpdateClient | 50 // update_client::UpdateClient |
| 49 void AddObserver(Observer* observer) override {} | 51 void AddObserver(Observer* observer) override {} |
| 50 void RemoveObserver(Observer* observer) override {} | 52 void RemoveObserver(Observer* observer) override {} |
| 51 void Install(const std::string& id, | 53 void Install(const std::string& id, |
| 52 const CrxDataCallback& crx_data_callback, | 54 const CrxDataCallback& crx_data_callback, |
| 53 const CompletionCallback& completion_callback) override {} | 55 const CompletionCallback& completion_callback) override {} |
| 54 void Update(const std::vector<std::string>& ids, | 56 void Update(const std::vector<std::string>& ids, |
| 55 const CrxDataCallback& crx_data_callback, | 57 const CrxDataCallback& crx_data_callback, |
| 56 const CompletionCallback& completion_callback) override; | 58 const CompletionCallback& completion_callback) override; |
| 57 bool GetCrxUpdateState( | 59 bool GetCrxUpdateState( |
| 58 const std::string& id, | 60 const std::string& id, |
| 59 update_client::CrxUpdateItem* update_item) const override { | 61 update_client::CrxUpdateItem* update_item) const override { |
| 60 return false; | 62 return false; |
| 61 } | 63 } |
| 62 bool IsUpdating(const std::string& id) const override { return false; } | 64 bool IsUpdating(const std::string& id) const override { return false; } |
| 63 void Stop() override {} | 65 void Stop() override {} |
| 64 void SendUninstallPing(const std::string& id, | 66 void SendUninstallPing(const std::string& id, |
| 65 const Version& version, | 67 const base::Version& version, |
| 66 int reason) override { | 68 int reason) override { |
| 67 uninstall_pings_.emplace_back(id, version, reason); | 69 uninstall_pings_.emplace_back(id, version, reason); |
| 68 } | 70 } |
| 69 | 71 |
| 70 protected: | 72 protected: |
| 71 friend class base::RefCounted<FakeUpdateClient>; | 73 friend class base::RefCounted<FakeUpdateClient>; |
| 72 ~FakeUpdateClient() override {} | 74 ~FakeUpdateClient() override {} |
| 73 | 75 |
| 74 std::vector<update_client::CrxComponent> data_; | 76 std::vector<update_client::CrxComponent> data_; |
| 75 std::vector<UninstallPing> uninstall_pings_; | 77 std::vector<UninstallPing> uninstall_pings_; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 EXPECT_EQ(*extension3->version(), pings[1].version) << reason; | 344 EXPECT_EQ(*extension3->version(), pings[1].version) << reason; |
| 343 EXPECT_EQ(reason, pings[1].reason) << reason; | 345 EXPECT_EQ(reason, pings[1].reason) << reason; |
| 344 | 346 |
| 345 pings.clear(); | 347 pings.clear(); |
| 346 } | 348 } |
| 347 } | 349 } |
| 348 | 350 |
| 349 } // namespace | 351 } // namespace |
| 350 | 352 |
| 351 } // namespace extensions | 353 } // namespace extensions |
| OLD | NEW |