• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2014 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
18 #define UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
19 
20 #include "update_engine/update_manager/system_provider.h"
21 
22 #include <string>
23 
24 #include "update_engine/update_manager/fake_variable.h"
25 
26 namespace chromeos_update_manager {
27 
28 // Fake implementation of the SystemProvider base class.
29 class FakeSystemProvider : public SystemProvider {
30  public:
FakeSystemProvider()31   FakeSystemProvider() {}
32 
var_is_normal_boot_mode()33   FakeVariable<bool>* var_is_normal_boot_mode() override {
34     return &var_is_normal_boot_mode_;
35   }
36 
var_is_official_build()37   FakeVariable<bool>* var_is_official_build() override {
38     return &var_is_official_build_;
39   }
40 
var_is_oobe_complete()41   FakeVariable<bool>* var_is_oobe_complete() override {
42     return &var_is_oobe_complete_;
43   }
44 
var_num_slots()45   FakeVariable<unsigned int>* var_num_slots() override {
46     return &var_num_slots_;
47   }
48 
var_kiosk_required_platform_version()49   FakeVariable<std::string>* var_kiosk_required_platform_version() override {
50     return &var_kiosk_required_platform_version_;
51   }
52 
var_chromeos_version()53   FakeVariable<base::Version>* var_chromeos_version() override {
54     return &var_version_;
55   }
56 
57  private:
58   FakeVariable<bool> var_is_normal_boot_mode_{"is_normal_boot_mode",
59                                               kVariableModeConst};
60   FakeVariable<bool> var_is_official_build_{"is_official_build",
61                                             kVariableModeConst};
62   FakeVariable<bool> var_is_oobe_complete_{"is_oobe_complete",
63                                            kVariableModePoll};
64   FakeVariable<unsigned int> var_num_slots_{"num_slots", kVariableModePoll};
65   FakeVariable<std::string> var_kiosk_required_platform_version_{
66       "kiosk_required_platform_version", kVariableModePoll};
67   FakeVariable<base::Version> var_version_{"chromeos_version",
68                                            kVariableModePoll};
69 
70   DISALLOW_COPY_AND_ASSIGN(FakeSystemProvider);
71 };
72 
73 }  // namespace chromeos_update_manager
74 
75 #endif  // UPDATE_ENGINE_UPDATE_MANAGER_FAKE_SYSTEM_PROVIDER_H_
76