summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 21:05:50 +0000
committerskrul@chromium.org <skrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 21:05:50 +0000
commit7a40f86e73875315d476a2ceca4b42929b0ce99d (patch)
treefcec583851b9a6b3ce8cf5ad2248d6b0fef3331c
parentbbebf6335e98a4a7c2846a0216b59d9745d44673 (diff)
downloadchromium_src-7a40f86e73875315d476a2ceca4b42929b0ce99d.zip
chromium_src-7a40f86e73875315d476a2ceca4b42929b0ce99d.tar.gz
chromium_src-7a40f86e73875315d476a2ceca4b42929b0ce99d.tar.bz2
fake libcros
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53516 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser_main.cc32
-rw-r--r--chrome/browser/chromeos/cros/cros_library_loader.h1
-rw-r--r--chrome/browser/chromeos/cros/fake_cryptohome_library.cc48
-rw-r--r--chrome/browser/chromeos/cros/fake_cryptohome_library.h35
-rw-r--r--chrome/browser/chromeos/cros/fake_input_method_library.cc59
-rw-r--r--chrome/browser/chromeos/cros/fake_input_method_library.h51
-rw-r--r--chrome/browser/chromeos/cros/fake_keyboard_library.cc27
-rw-r--r--chrome/browser/chromeos/cros/fake_keyboard_library.h24
-rw-r--r--chrome/browser/chromeos/cros/fake_library_loader.cc13
-rw-r--r--chrome/browser/chromeos/cros/fake_library_loader.h22
-rw-r--r--chrome/browser/chromeos/cros/fake_login_library.cc22
-rw-r--r--chrome/browser/chromeos/cros/fake_login_library.h24
-rw-r--r--chrome/browser/chromeos/cros/fake_mount_library.cc19
-rw-r--r--chrome/browser/chromeos/cros/fake_mount_library.h28
-rw-r--r--chrome/browser/chromeos/cros/fake_network_library.cc103
-rw-r--r--chrome/browser/chromeos/cros/fake_network_library.h105
-rw-r--r--chrome/browser/chromeos/cros/fake_power_library.cc15
-rw-r--r--chrome/browser/chromeos/cros/fake_power_library.h32
-rw-r--r--chrome/browser/chromeos/cros/fake_screen_lock_library.cc27
-rw-r--r--chrome/browser/chromeos/cros/fake_screen_lock_library.h26
-rw-r--r--chrome/browser/chromeos/cros/fake_synaptics_library.cc17
-rw-r--r--chrome/browser/chromeos/cros/fake_synaptics_library.h22
-rw-r--r--chrome/browser/chromeos/cros/fake_system_library.cc29
-rw-r--r--chrome/browser/chromeos/cros/fake_system_library.h29
-rw-r--r--chrome/browser/chromeos/cros/fake_update_library.cc19
-rw-r--r--chrome/browser/chromeos/cros/fake_update_library.h26
-rw-r--r--chrome/browser/profile_manager.cc4
-rw-r--r--chrome/chrome_browser.gypi24
-rw-r--r--chrome/common/chrome_switches.cc4
-rw-r--r--chrome/common/chrome_switches.h1
30 files changed, 885 insertions, 3 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 7d645fe..f4a4b1d 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -144,6 +144,18 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/fake_cryptohome_library.h"
+#include "chrome/browser/chromeos/cros/fake_input_method_library.h"
+#include "chrome/browser/chromeos/cros/fake_keyboard_library.h"
+#include "chrome/browser/chromeos/cros/fake_library_loader.h"
+#include "chrome/browser/chromeos/cros/fake_login_library.h"
+#include "chrome/browser/chromeos/cros/fake_mount_library.h"
+#include "chrome/browser/chromeos/cros/fake_network_library.h"
+#include "chrome/browser/chromeos/cros/fake_screen_lock_library.h"
+#include "chrome/browser/chromeos/cros/fake_synaptics_library.h"
+#include "chrome/browser/chromeos/cros/fake_system_library.h"
+#include "chrome/browser/chromeos/cros/fake_power_library.h"
+#include "chrome/browser/chromeos/cros/fake_update_library.h"
#include "chrome/browser/chromeos/cros/screen_lock_library.h"
#include "chrome/browser/chromeos/customization_document.h"
#include "chrome/browser/chromeos/external_metrics.h"
@@ -979,6 +991,26 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
#endif
+#if defined(OS_CHROMEOS)
+ // Install a "fake" version of libcros if specified.
+ if (parsed_command_line.HasSwitch(switches::kUseFakeLibcros)) {
+ chromeos::CrosLibrary::TestApi* test_api =
+ chromeos::CrosLibrary::Get()->GetTestApi();
+ test_api->SetLibraryLoader(new chromeos::FakeLibraryLoader, true);
+ test_api->SetSynapticsLibrary(new chromeos::FakeSynapticsLibrary, true);
+ test_api->SetInputMethodLibrary(new chromeos::FakeInputMethodLibrary, true);
+ test_api->SetKeyboardLibrary(new chromeos::FakeKeyboardLibrary, true);
+ test_api->SetNetworkLibrary(new chromeos::FakeNetworkLibrary, true);
+ test_api->SetPowerLibrary(new chromeos::FakePowerLibrary, true);
+ test_api->SetSystemLibrary(new chromeos::FakeSystemLibrary, true);
+ test_api->SetLoginLibrary(new chromeos::FakeLoginLibrary, true);
+ test_api->SetCryptohomeLibrary(new chromeos::FakeCryptohomeLibrary, true);
+ test_api->SetScreenLockLibrary(new chromeos::FakeScreenLockLibrary, true);
+ test_api->SetMountLibrary(new chromeos::FakeMountLibrary, true);
+ test_api->SetUpdateLibrary(new chromeos::FakeUpdateLibrary, true);
+}
+#endif
+
// Profile creation ----------------------------------------------------------
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/chromeos/cros/cros_library_loader.h b/chrome/browser/chromeos/cros/cros_library_loader.h
index c326ab6..efc6e4a 100644
--- a/chrome/browser/chromeos/cros/cros_library_loader.h
+++ b/chrome/browser/chromeos/cros/cros_library_loader.h
@@ -30,4 +30,3 @@ class CrosLibraryLoader : public LibraryLoader {
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_CROS_CROS_LIBRARY_LOADER_H_
-
diff --git a/chrome/browser/chromeos/cros/fake_cryptohome_library.cc b/chrome/browser/chromeos/cros/fake_cryptohome_library.cc
new file mode 100644
index 0000000..37ecdc0
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_cryptohome_library.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_cryptohome_library.h"
+
+namespace chromeos {
+
+FakeCryptohomeLibrary::FakeCryptohomeLibrary() {
+ // The salt must be non-empty and an even length.
+ salt_.push_back(0);
+ salt_.push_back(0);
+}
+
+bool FakeCryptohomeLibrary::CheckKey(const std::string& user_email,
+ const std::string& passhash) {
+ return true;
+}
+
+bool FakeCryptohomeLibrary::MigrateKey(const std::string& user_email,
+ const std::string& old_hash,
+ const std::string& new_hash) {
+ return true;
+}
+
+bool FakeCryptohomeLibrary::Remove(const std::string& user_email) {
+ return true;
+}
+
+bool FakeCryptohomeLibrary::Mount(const std::string& user_email,
+ const std::string& passhash,
+ int* error_code) {
+ return true;
+}
+
+bool FakeCryptohomeLibrary::MountForBwsi(int* error_code) {
+ return true;
+}
+
+bool FakeCryptohomeLibrary::IsMounted() {
+ return true;
+}
+
+CryptohomeBlob FakeCryptohomeLibrary::GetSystemSalt() {
+ return salt_;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_cryptohome_library.h b/chrome/browser/chromeos/cros/fake_cryptohome_library.h
new file mode 100644
index 0000000..039bf42
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_cryptohome_library.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_CRYPTOHOME_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_CRYPTOHOME_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/cryptohome_library.h"
+
+namespace chromeos {
+
+class FakeCryptohomeLibrary : public CryptohomeLibrary {
+ public:
+ FakeCryptohomeLibrary();
+ virtual ~FakeCryptohomeLibrary() {}
+ virtual bool Mount(const std::string& user_email,
+ const std::string& passhash,
+ int* error_code);
+ virtual bool MountForBwsi(int* error_code);
+ virtual bool CheckKey(const std::string& user_email,
+ const std::string& passhash);
+ virtual bool MigrateKey(const std::string& user_email,
+ const std::string& old_hash,
+ const std::string& new_hash);
+ virtual bool Remove(const std::string& user_email);
+ virtual bool IsMounted();
+ virtual CryptohomeBlob GetSystemSalt();
+
+ private:
+ CryptohomeBlob salt_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_CRYPTOHOME_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_input_method_library.cc b/chrome/browser/chromeos/cros/fake_input_method_library.cc
new file mode 100644
index 0000000..36095f3
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_input_method_library.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/chromeos/cros/fake_input_method_library.h"
+
+namespace chromeos {
+
+FakeInputMethodLibrary::FakeInputMethodLibrary()
+ : previous_input_method_("", "", "", ""),
+ current_input_method_("", "", "", "") {
+}
+
+void FakeInputMethodLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeInputMethodLibrary::RemoveObserver(Observer* observer) {
+}
+
+chromeos::InputMethodDescriptors*
+FakeInputMethodLibrary::GetActiveInputMethods() {
+ return CreateFallbackInputMethodDescriptors();
+}
+
+size_t FakeInputMethodLibrary::GetNumActiveInputMethods() {
+ scoped_ptr<InputMethodDescriptors> input_methods(GetActiveInputMethods());
+ return input_methods->size();
+}
+
+chromeos::InputMethodDescriptors*
+FakeInputMethodLibrary::GetSupportedInputMethods() {
+ return CreateFallbackInputMethodDescriptors();
+}
+
+void FakeInputMethodLibrary::ChangeInputMethod(
+ const std::string& input_method_id) {
+}
+
+void FakeInputMethodLibrary::SetImePropertyActivated(const std::string& key,
+ bool activated) {
+}
+
+bool FakeInputMethodLibrary::InputMethodIsActivated(
+ const std::string& input_method_id) {
+ return true;
+}
+
+bool FakeInputMethodLibrary::GetImeConfig(
+ const char* section, const char* config_name, ImeConfigValue* out_value) {
+ return true;
+}
+
+bool FakeInputMethodLibrary::SetImeConfig(
+ const char* section, const char* config_name, const ImeConfigValue& value) {
+ return true;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_input_method_library.h b/chrome/browser/chromeos/cros/fake_input_method_library.h
new file mode 100644
index 0000000..306c3d3
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_input_method_library.h
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_INPUT_METHOD_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_INPUT_METHOD_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/input_method_library.h"
+#include "third_party/cros/chromeos_input_method.h"
+
+namespace chromeos {
+
+class FakeInputMethodLibrary : public InputMethodLibrary {
+ public:
+ FakeInputMethodLibrary();
+ virtual ~FakeInputMethodLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual InputMethodDescriptors* GetActiveInputMethods();
+ virtual size_t GetNumActiveInputMethods();
+ virtual InputMethodDescriptors* GetSupportedInputMethods();
+ virtual void ChangeInputMethod(const std::string& input_method_id);
+ virtual void SetImePropertyActivated(const std::string& key,
+ bool activated);
+ virtual bool InputMethodIsActivated(const std::string& input_method_id);
+ virtual bool GetImeConfig(
+ const char* section, const char* config_name, ImeConfigValue* out_value);
+ virtual bool SetImeConfig(const char* section,
+ const char* config_name,
+ const ImeConfigValue& value);
+
+ virtual const InputMethodDescriptor& previous_input_method() const {
+ return previous_input_method_;
+ }
+ virtual const InputMethodDescriptor& current_input_method() const {
+ return current_input_method_;
+ }
+
+ virtual const ImePropertyList& current_ime_properties() const {
+ return current_ime_properties_;
+ }
+
+ private:
+ InputMethodDescriptor previous_input_method_;
+ InputMethodDescriptor current_input_method_;
+ ImePropertyList current_ime_properties_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_INPUT_METHOD_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_keyboard_library.cc b/chrome/browser/chromeos/cros/fake_keyboard_library.cc
new file mode 100644
index 0000000..7f9b21e
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_keyboard_library.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_keyboard_library.h"
+
+namespace chromeos {
+
+std::string FakeKeyboardLibrary::GetCurrentKeyboardLayoutName() const {
+ return "";
+}
+
+bool FakeKeyboardLibrary::SetCurrentKeyboardLayoutByName(
+ const std::string& layout_name) {
+ return true;
+}
+
+bool FakeKeyboardLibrary::GetKeyboardLayoutPerWindow(
+ bool* is_per_window) const {
+ return true;
+}
+
+bool FakeKeyboardLibrary::SetKeyboardLayoutPerWindow(bool is_per_window) {
+ return true;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_keyboard_library.h b/chrome/browser/chromeos/cros/fake_keyboard_library.h
new file mode 100644
index 0000000..efc3947
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_keyboard_library.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_KEYBOARD_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_KEYBOARD_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/keyboard_library.h"
+
+namespace chromeos {
+
+class FakeKeyboardLibrary : public KeyboardLibrary {
+ public:
+ FakeKeyboardLibrary() {}
+ virtual ~FakeKeyboardLibrary() {}
+ virtual std::string GetCurrentKeyboardLayoutName() const;
+ virtual bool SetCurrentKeyboardLayoutByName(const std::string& layout_name);
+ virtual bool GetKeyboardLayoutPerWindow(bool* is_per_window) const;
+ virtual bool SetKeyboardLayoutPerWindow(bool is_per_window);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_KEYBOARD_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_library_loader.cc b/chrome/browser/chromeos/cros/fake_library_loader.cc
new file mode 100644
index 0000000..6d29d1b
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_library_loader.cc
@@ -0,0 +1,13 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_library_loader.h"
+
+namespace chromeos {
+
+bool FakeLibraryLoader::Load(std::string* load_error_string) {
+ return true;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_library_loader.h b/chrome/browser/chromeos/cros/fake_library_loader.h
new file mode 100644
index 0000000..4ee832e
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_library_loader.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_LIBRARY_LOADER_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_LIBRARY_LOADER_H_
+
+#include "chrome/browser/chromeos/cros/cros_library_loader.h"
+
+namespace chromeos {
+
+// Fake for libcros library loader.
+class FakeLibraryLoader : public LibraryLoader {
+ public:
+ FakeLibraryLoader() {}
+ virtual ~FakeLibraryLoader() {}
+ virtual bool Load(std::string* load_error_string);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_LIBRARY_LOADER_H_
diff --git a/chrome/browser/chromeos/cros/fake_login_library.cc b/chrome/browser/chromeos/cros/fake_login_library.cc
new file mode 100644
index 0000000..af41fa4
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_login_library.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_login_library.h"
+
+namespace chromeos {
+
+bool FakeLoginLibrary::EmitLoginPromptReady() {
+ return true;
+}
+
+bool FakeLoginLibrary::StartSession(const std::string& user_email,
+ const std::string& unique_id) {
+ return true;
+}
+
+bool FakeLoginLibrary::StopSession(const std::string& unique_id) {
+ return true;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_login_library.h b/chrome/browser/chromeos/cros/fake_login_library.h
new file mode 100644
index 0000000..af824f0
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_login_library.h
@@ -0,0 +1,24 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_LOGIN_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_LOGIN_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/login_library.h"
+
+namespace chromeos {
+
+class FakeLoginLibrary : public LoginLibrary {
+ public:
+ FakeLoginLibrary() {}
+ virtual ~FakeLoginLibrary() {}
+ virtual bool EmitLoginPromptReady();
+ virtual bool StartSession(const std::string& user_email,
+ const std::string& unique_id);
+ virtual bool StopSession(const std::string& unique_id);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_LOGIN_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_mount_library.cc b/chrome/browser/chromeos/cros/fake_mount_library.cc
new file mode 100644
index 0000000..9b2ae4f
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_mount_library.cc
@@ -0,0 +1,19 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_mount_library.h"
+
+namespace chromeos {
+
+void FakeMountLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeMountLibrary::RemoveObserver(Observer* observer) {
+}
+
+bool FakeMountLibrary::MountPath(const char* device_path) {
+ return true;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_mount_library.h b/chrome/browser/chromeos/cros/fake_mount_library.h
new file mode 100644
index 0000000..4f99761
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_mount_library.h
@@ -0,0 +1,28 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_MOUNT_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_MOUNT_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/mount_library.h"
+#include "third_party/cros/chromeos_mount.h"
+
+namespace chromeos {
+
+class FakeMountLibrary : public MountLibrary {
+ public:
+ FakeMountLibrary() {}
+ virtual ~FakeMountLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual const DiskVector& disks() const { return disks_; }
+ virtual bool MountPath(const char* device_path);
+
+ private:
+ DiskVector disks_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_MOUNT_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_network_library.cc b/chrome/browser/chromeos/cros/fake_network_library.cc
new file mode 100644
index 0000000..d95d73f
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_network_library.cc
@@ -0,0 +1,103 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_network_library.h"
+
+namespace chromeos {
+
+FakeNetworkLibrary::FakeNetworkLibrary() : ip_address_("1.1.1.1") {
+}
+
+void FakeNetworkLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeNetworkLibrary::RemoveObserver(Observer* observer) {
+}
+
+bool FakeNetworkLibrary::Connected() const {
+ return true;
+}
+
+bool FakeNetworkLibrary::Connecting() const {
+ return false;
+}
+
+const std::string& FakeNetworkLibrary::IPAddress() const {
+ return ip_address_;
+}
+
+bool FakeNetworkLibrary::FindWifiNetworkByPath(
+ const std::string& path, WifiNetwork* result) const {
+ return false;
+}
+
+bool FakeNetworkLibrary::FindCellularNetworkByPath(
+ const std::string& path, CellularNetwork* result) const {
+ return false;
+}
+
+void FakeNetworkLibrary::RequestWifiScan() {
+}
+
+bool FakeNetworkLibrary::ConnectToPreferredNetworkIfAvailable() {
+ return false;
+}
+
+bool FakeNetworkLibrary::PreferredNetworkConnected() {
+ return false;
+}
+
+bool FakeNetworkLibrary::PreferredNetworkFailed() {
+ return false;
+}
+
+void FakeNetworkLibrary::ConnectToWifiNetwork(WifiNetwork network,
+ const std::string& password,
+ const std::string& identity,
+ const std::string& certpath) {
+}
+
+void FakeNetworkLibrary::ConnectToWifiNetwork(const std::string& ssid,
+ const std::string& password,
+ const std::string& identity,
+ const std::string& certpath,
+ bool auto_connect) {
+}
+
+void FakeNetworkLibrary::ConnectToCellularNetwork(CellularNetwork network) {
+}
+
+void FakeNetworkLibrary::DisconnectFromWirelessNetwork(
+ const WirelessNetwork& network) {
+}
+
+void FakeNetworkLibrary::SaveWifiNetwork(const WifiNetwork& network) {
+}
+
+void FakeNetworkLibrary::ForgetWirelessNetwork(const WirelessNetwork& network) {
+}
+
+void FakeNetworkLibrary::EnableEthernetNetworkDevice(bool enable) {
+}
+
+void FakeNetworkLibrary::EnableWifiNetworkDevice(bool enable) {
+}
+
+void FakeNetworkLibrary::EnableCellularNetworkDevice(bool enable) {
+}
+
+void FakeNetworkLibrary::EnableOfflineMode(bool enable) {
+}
+
+NetworkIPConfigVector FakeNetworkLibrary::GetIPConfigs(
+ const std::string& device_path) {
+ NetworkIPConfigVector ipconfig_vector;
+ return ipconfig_vector;
+}
+
+std::string FakeNetworkLibrary::GetHtmlInfo(int refresh) {
+ return "";
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_network_library.h b/chrome/browser/chromeos/cros/fake_network_library.h
new file mode 100644
index 0000000..821b241
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_network_library.h
@@ -0,0 +1,105 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_NETWORK_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_NETWORK_LIBRARY_H_
+
+#include <string>
+
+#include "base/string_util.h"
+#include "chrome/browser/chromeos/cros/network_library.h"
+
+namespace chromeos {
+
+class FakeNetworkLibrary : public NetworkLibrary {
+ public:
+ FakeNetworkLibrary();
+ virtual ~FakeNetworkLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+
+ virtual const EthernetNetwork& ethernet_network() const { return ethernet_; }
+ virtual bool ethernet_connecting() const { return false; }
+ virtual bool ethernet_connected() const { return true; }
+
+ virtual const std::string& wifi_name() const { return EmptyString(); }
+ virtual bool wifi_connecting() const { return false; }
+ virtual bool wifi_connected() const { return false; }
+ virtual int wifi_strength() const { return 0; }
+
+ virtual const std::string& cellular_name() const { return EmptyString(); }
+ virtual bool cellular_connecting() const { return false; }
+ virtual bool cellular_connected() const { return false; }
+ virtual int cellular_strength() const { return 0; }
+
+ virtual bool Connected() const;
+ virtual bool Connecting() const;
+ virtual const std::string& IPAddress() const;
+
+ virtual const WifiNetworkVector& wifi_networks() const {
+ return wifi_networks_;
+ }
+
+ virtual const WifiNetworkVector& remembered_wifi_networks() const {
+ return wifi_networks_;
+ }
+
+ virtual const CellularNetworkVector& cellular_networks() const {
+ return cellular_networks_;
+ }
+
+ virtual const CellularNetworkVector& remembered_cellular_networks() const {
+ return cellular_networks_;
+ }
+
+ virtual bool FindWifiNetworkByPath(const std::string& path,
+ WifiNetwork* network) const;
+ virtual bool FindCellularNetworkByPath(const std::string& path,
+ CellularNetwork* network) const;
+
+ virtual void RequestWifiScan();
+ virtual bool ConnectToPreferredNetworkIfAvailable();
+ virtual bool PreferredNetworkConnected();
+ virtual bool PreferredNetworkFailed();
+ virtual void ConnectToWifiNetwork(WifiNetwork network,
+ const std::string& password,
+ const std::string& identity,
+ const std::string& certpath);
+ virtual void ConnectToWifiNetwork(const std::string& ssid,
+ const std::string& password,
+ const std::string& identity,
+ const std::string& certpath,
+ bool auto_connect);
+ virtual void ConnectToCellularNetwork(CellularNetwork network);
+ virtual void DisconnectFromWirelessNetwork(const WirelessNetwork& network);
+ virtual void SaveWifiNetwork(const WifiNetwork& network);
+ virtual void ForgetWirelessNetwork(const WirelessNetwork& network);
+
+ virtual bool ethernet_available() const { return true; }
+ virtual bool wifi_available() const { return false; }
+ virtual bool cellular_available() const { return false; }
+
+ virtual bool ethernet_enabled() const { return true; }
+ virtual bool wifi_enabled() const { return false; }
+ virtual bool cellular_enabled() const { return false; }
+
+ virtual bool offline_mode() const { return false; }
+
+ virtual void EnableEthernetNetworkDevice(bool enable);
+ virtual void EnableWifiNetworkDevice(bool enable);
+ virtual void EnableCellularNetworkDevice(bool enable);
+ virtual void EnableOfflineMode(bool enable);
+ virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path);
+ virtual std::string GetHtmlInfo(int refresh);
+
+ private:
+ std::string ip_address_;
+ EthernetNetwork ethernet_;
+ WifiNetworkVector wifi_networks_;
+ CellularNetworkVector cellular_networks_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_NETWORK_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_power_library.cc b/chrome/browser/chromeos/cros/fake_power_library.cc
new file mode 100644
index 0000000..0d06a33
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_power_library.cc
@@ -0,0 +1,15 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_power_library.h"
+
+namespace chromeos {
+
+void FakePowerLibrary::AddObserver(Observer* observer) {
+}
+
+void FakePowerLibrary::RemoveObserver(Observer* observer) {
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_power_library.h b/chrome/browser/chromeos/cros/fake_power_library.h
new file mode 100644
index 0000000..0d74eac
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_power_library.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_POWER_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_POWER_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/power_library.h"
+
+namespace chromeos {
+
+class FakePowerLibrary : public PowerLibrary {
+ public:
+ FakePowerLibrary() {}
+ virtual ~FakePowerLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual bool line_power_on() const { return true; }
+ virtual bool battery_fully_charged() const { return true; }
+ virtual double battery_percentage() const { return 100; }
+ virtual bool battery_is_present() const { return true; }
+ virtual base::TimeDelta battery_time_to_empty() const {
+ return base::TimeDelta::FromSeconds(0);
+ }
+ virtual base::TimeDelta battery_time_to_full() const {
+ return base::TimeDelta::FromSeconds(0);
+ }
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_POWER_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_screen_lock_library.cc b/chrome/browser/chromeos/cros/fake_screen_lock_library.cc
new file mode 100644
index 0000000..bbdd758
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_screen_lock_library.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_screen_lock_library.h"
+
+namespace chromeos {
+
+void FakeScreenLockLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeScreenLockLibrary::RemoveObserver(Observer* observer) {
+}
+
+void FakeScreenLockLibrary::NotifyScreenLockRequested() {
+}
+
+void FakeScreenLockLibrary::NotifyScreenLockCompleted() {
+}
+
+void FakeScreenLockLibrary::NotifyScreenUnlockRequested() {
+}
+
+void FakeScreenLockLibrary::NotifyScreenUnlockCompleted() {
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_screen_lock_library.h b/chrome/browser/chromeos/cros/fake_screen_lock_library.h
new file mode 100644
index 0000000..dd063c9
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_screen_lock_library.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_SCREEN_LOCK_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_SCREEN_LOCK_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/screen_lock_library.h"
+
+namespace chromeos {
+
+class FakeScreenLockLibrary : public ScreenLockLibrary {
+ public:
+ FakeScreenLockLibrary() {}
+ virtual ~FakeScreenLockLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual void NotifyScreenLockRequested();
+ virtual void NotifyScreenLockCompleted();
+ virtual void NotifyScreenUnlockRequested();
+ virtual void NotifyScreenUnlockCompleted();
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_SCREEN_LOCK_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_synaptics_library.cc b/chrome/browser/chromeos/cros/fake_synaptics_library.cc
new file mode 100644
index 0000000..7fac85b
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_synaptics_library.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_synaptics_library.h"
+
+namespace chromeos {
+
+void FakeSynapticsLibrary::SetBoolParameter(SynapticsParameter param,
+ bool value) {
+}
+
+void FakeSynapticsLibrary::SetRangeParameter(SynapticsParameter param,
+ int value) {
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_synaptics_library.h b/chrome/browser/chromeos/cros/fake_synaptics_library.h
new file mode 100644
index 0000000..e30aa3d
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_synaptics_library.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYNAPTICS_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYNAPTICS_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/synaptics_library.h"
+
+namespace chromeos {
+
+class FakeSynapticsLibrary : public SynapticsLibrary {
+ public:
+ FakeSynapticsLibrary() {}
+ virtual ~FakeSynapticsLibrary() {}
+ virtual void SetBoolParameter(SynapticsParameter param, bool value);
+ virtual void SetRangeParameter(SynapticsParameter param, int value);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYNAPTICS_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_system_library.cc b/chrome/browser/chromeos/cros/fake_system_library.cc
new file mode 100644
index 0000000..adf65ca
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_system_library.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_system_library.h"
+
+namespace chromeos {
+
+FakeSystemLibrary::FakeSystemLibrary() {
+ std::string id = "US/Pacific";
+ icu::TimeZone* timezone =
+ icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(id));
+ timezone_.reset(timezone);
+}
+
+void FakeSystemLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeSystemLibrary::RemoveObserver(Observer* observer) {
+}
+
+const icu::TimeZone& FakeSystemLibrary::GetTimezone() {
+ return *timezone_.get();
+}
+
+void FakeSystemLibrary::SetTimezone(const icu::TimeZone* timezone) {
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_system_library.h b/chrome/browser/chromeos/cros/fake_system_library.h
new file mode 100644
index 0000000..0ef8d33
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_system_library.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYSTEM_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYSTEM_LIBRARY_H_
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/chromeos/cros/system_library.h"
+#include "unicode/timezone.h"
+
+namespace chromeos {
+
+class FakeSystemLibrary : public SystemLibrary {
+ public:
+ FakeSystemLibrary();
+ virtual ~FakeSystemLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual const icu::TimeZone& GetTimezone();
+ virtual void SetTimezone(const icu::TimeZone*);
+
+ private:
+ scoped_ptr<icu::TimeZone> timezone_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_SYSTEM_LIBRARY_H_
diff --git a/chrome/browser/chromeos/cros/fake_update_library.cc b/chrome/browser/chromeos/cros/fake_update_library.cc
new file mode 100644
index 0000000..1cfb276
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_update_library.cc
@@ -0,0 +1,19 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/cros/fake_update_library.h"
+
+namespace chromeos {
+
+void FakeUpdateLibrary::AddObserver(Observer* observer) {
+}
+
+void FakeUpdateLibrary::RemoveObserver(Observer* observer) {
+}
+
+const UpdateLibrary::Status& FakeUpdateLibrary::status() const {
+ return status_;
+}
+
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/cros/fake_update_library.h b/chrome/browser/chromeos/cros/fake_update_library.h
new file mode 100644
index 0000000..bda0f10
--- /dev/null
+++ b/chrome/browser/chromeos/cros/fake_update_library.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_CROS_FAKE_UPDATE_LIBRARY_H_
+#define CHROME_BROWSER_CHROMEOS_CROS_FAKE_UPDATE_LIBRARY_H_
+
+#include "chrome/browser/chromeos/cros/update_library.h"
+
+namespace chromeos {
+
+class FakeUpdateLibrary : public UpdateLibrary {
+ public:
+ FakeUpdateLibrary() {}
+ virtual ~FakeUpdateLibrary() {}
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+ virtual const Status& status() const;
+
+ private:
+ Status status_;
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_CROS_FAKE_UPDATE_LIBRARY_H_
diff --git a/chrome/browser/profile_manager.cc b/chrome/browser/profile_manager.cc
index 8770b1d..4f6ec85 100644
--- a/chrome/browser/profile_manager.cc
+++ b/chrome/browser/profile_manager.cc
@@ -135,8 +135,8 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
// many of the browser and ui tests fail. We do return the OTR profile
// if the login-profile switch is passed so that we can test this.
// TODO(davemoore) Fix the tests so they allow OTR profiles.
- if (!command_line.HasSwitch(switches::kTestType) ||
- command_line.HasSwitch(switches::kLoginProfile)) {
+ if (false && (!command_line.HasSwitch(switches::kTestType) ||
+ command_line.HasSwitch(switches::kLoginProfile))) {
// Don't init extensions for this profile
profile = GetProfile(default_profile_dir, false);
profile = profile->GetOffTheRecordProfile();
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 849abcf..6623ea3 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -368,6 +368,30 @@
'browser/chromeos/cros/cryptohome_library.h',
'browser/chromeos/cros/keyboard_library.cc',
'browser/chromeos/cros/keyboard_library.h',
+ 'browser/chromeos/cros/fake_cryptohome_library.cc',
+ 'browser/chromeos/cros/fake_cryptohome_library.h',
+ 'browser/chromeos/cros/fake_input_method_library.cc',
+ 'browser/chromeos/cros/fake_input_method_library.h',
+ 'browser/chromeos/cros/fake_keyboard_library.cc',
+ 'browser/chromeos/cros/fake_keyboard_library.h',
+ 'browser/chromeos/cros/fake_library_loader.cc',
+ 'browser/chromeos/cros/fake_library_loader.h',
+ 'browser/chromeos/cros/fake_login_library.cc',
+ 'browser/chromeos/cros/fake_login_library.h',
+ 'browser/chromeos/cros/fake_mount_library.cc',
+ 'browser/chromeos/cros/fake_mount_library.h',
+ 'browser/chromeos/cros/fake_network_library.cc',
+ 'browser/chromeos/cros/fake_network_library.h',
+ 'browser/chromeos/cros/fake_screen_lock_library.cc',
+ 'browser/chromeos/cros/fake_screen_lock_library.h',
+ 'browser/chromeos/cros/fake_synaptics_library.cc',
+ 'browser/chromeos/cros/fake_synaptics_library.h',
+ 'browser/chromeos/cros/fake_system_library.cc',
+ 'browser/chromeos/cros/fake_system_library.h',
+ 'browser/chromeos/cros/fake_power_library.cc',
+ 'browser/chromeos/cros/fake_power_library.h',
+ 'browser/chromeos/cros/fake_update_library.h',
+ 'browser/chromeos/cros/fake_update_library.cc',
'browser/chromeos/cros/input_method_library.cc',
'browser/chromeos/cros/input_method_library.h',
'browser/chromeos/cros/login_library.cc',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 93586b5..1bbbe69 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -1037,6 +1037,10 @@ const char kStartupManifest[] = "startup-manifest";
// TODO(denisromanov): delete this when not needed for testing.
const char kServicesManifest[] = "services-manifest";
+// Install a "fake" version of libcros to allow ChromeOS to run on a
+// regular linux box. This is useful to developers working on
+// features that do not require actual ChromeOS hardware.
+const char kUseFakeLibcros[] = "use-fake-libcros";
#endif
#if defined(OS_LINUX)
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index ce8a7bc..692ca3a 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -303,6 +303,7 @@ extern const char kChromeosLogToFile[];
extern const char kStartupManifest[];
// TODO(denisromanov): Remove this flag when it is not needed for testing, too.
extern const char kServicesManifest[];
+extern const char kUseFakeLibcros[];
#endif
#if defined(OS_LINUX)