1 // Copyright 2019 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_UI_WEBUI_HELP_TEST_VERSION_UPDATER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_HELP_TEST_VERSION_UPDATER_H_ 7 8 #include "base/macros.h" 9 #include "build/build_config.h" 10 #include "chrome/browser/ui/webui/help/version_updater.h" 11 12 // A very simple VersionUpdater implementation that immediately invokes the 13 // StatusCallback with predefined parameters. Since this is only used for 14 // testing, only the parts of the interface that are needed for testing have 15 // been implemented. 16 class TestVersionUpdater : public VersionUpdater { 17 public: 18 TestVersionUpdater(); 19 ~TestVersionUpdater() override; 20 21 void CheckForUpdate(const StatusCallback& callback, 22 const PromoteCallback&) override; 23 SetReturnedStatus(Status status)24 void SetReturnedStatus(Status status) { status_ = status; } 25 26 // VersionUpdater implementation: 27 #if defined(OS_MACOSX) PromoteUpdater()28 void PromoteUpdater() const override {} 29 #endif 30 #if defined(OS_CHROMEOS) SetChannel(const std::string & channel,bool is_powerwash_allowed)31 void SetChannel(const std::string& channel, 32 bool is_powerwash_allowed) override {} GetChannel(bool get_current_channel,const ChannelCallback & callback)33 void GetChannel(bool get_current_channel, 34 const ChannelCallback& callback) override {} GetEolInfo(EolInfoCallback callback)35 void GetEolInfo(EolInfoCallback callback) override {} SetUpdateOverCellularOneTimePermission(const StatusCallback & callback,const std::string & update_version,int64_t update_size)36 void SetUpdateOverCellularOneTimePermission(const StatusCallback& callback, 37 const std::string& update_version, 38 int64_t update_size) override {} 39 #endif 40 41 private: 42 Status status_ = Status::UPDATED; 43 int progress_ = 0; 44 bool rollback_ = false; 45 std::string version_; 46 int64_t update_size_ = 0; 47 base::string16 message_; 48 49 DISALLOW_COPY_AND_ASSIGN(TestVersionUpdater); 50 }; 51 52 #endif // CHROME_BROWSER_UI_WEBUI_HELP_TEST_VERSION_UPDATER_H_ 53