buffet: Read config/state paths from commandline This allows us to use custom paths and configurations in test without altering normal system operation. BUG=brillo:172 TEST=unittests Change-Id: I1a969093683205d5f600ff88ebba8b22c05368b4 Reviewed-on: https://chromium-review.googlesource.com/247504 Tested-by: Christopher Wiley <wiley@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Christopher Wiley <wiley@chromium.org>
diff --git a/buffet/device_registration_info.cc b/buffet/device_registration_info.cc index e947157..187ec39 100644 --- a/buffet/device_registration_info.cc +++ b/buffet/device_registration_info.cc
@@ -25,7 +25,6 @@ #include "buffet/commands/command_manager.h" #include "buffet/device_registration_storage_keys.h" #include "buffet/states/state_manager.h" -#include "buffet/storage_impls.h" #include "buffet/utils.h" const char buffet::kErrorDomainOAuth2[] = "oauth2"; @@ -57,9 +56,6 @@ namespace { -const base::FilePath::CharType kDeviceInfoFilePath[] = - FILE_PATH_LITERAL("/var/lib/buffet/device_reg_info"); - std::pair<std::string, std::string> BuildAuthHeader( const std::string& access_token_type, const std::string& access_token) { @@ -146,25 +142,11 @@ DeviceRegistrationInfo::DeviceRegistrationInfo( const std::shared_ptr<CommandManager>& command_manager, const std::shared_ptr<StateManager>& state_manager, - std::unique_ptr<chromeos::KeyValueStore> config_store) - : DeviceRegistrationInfo( - command_manager, - state_manager, - std::move(config_store), - chromeos::http::Transport::CreateDefault(), - // TODO(avakulenko): Figure out security implications of storing - // this data unencrypted. - std::make_shared<FileStorage>(base::FilePath{kDeviceInfoFilePath})) { -} - -DeviceRegistrationInfo::DeviceRegistrationInfo( - const std::shared_ptr<CommandManager>& command_manager, - const std::shared_ptr<StateManager>& state_manager, std::unique_ptr<chromeos::KeyValueStore> config_store, const std::shared_ptr<chromeos::http::Transport>& transport, - const std::shared_ptr<StorageInterface>& storage) + const std::shared_ptr<StorageInterface>& state_store) : transport_{transport}, - storage_{storage}, + storage_{state_store}, command_manager_{command_manager}, state_manager_{state_manager}, config_store_{std::move(config_store)} {