| 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 <cstdlib> | 5 #include <cstdlib> |
| 6 #include <cstring> | 6 #include <cstring> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 15 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| 16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 19 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 19 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/test/base/scoped_testing_local_state.h" | 21 #include "chrome/test/base/scoped_testing_local_state.h" |
| 22 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
| 25 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
| 26 #include "chromeos/dbus/fake_dbus_thread_manager.h" | |
| 27 #include "chromeos/settings/cros_settings_names.h" | 26 #include "chromeos/settings/cros_settings_names.h" |
| 28 #include "chromeos/settings/cros_settings_provider.h" | 27 #include "chromeos/settings/cros_settings_provider.h" |
| 29 #include "components/user_manager/user.h" | 28 #include "components/user_manager/user.h" |
| 30 #include "components/user_manager/user_manager.h" | 29 #include "components/user_manager/user_manager.h" |
| 31 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
| 32 #include "content/public/test/test_browser_thread_bundle.h" | 31 #include "content/public/test/test_browser_thread_bundle.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 33 |
| 35 namespace chromeos { | 34 namespace chromeos { |
| 36 | 35 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 SetDeviceSettings(false, "", false); | 72 SetDeviceSettings(false, "", false); |
| 74 | 73 |
| 75 // Register an in-memory local settings instance. | 74 // Register an in-memory local settings instance. |
| 76 local_state_.reset( | 75 local_state_.reset( |
| 77 new ScopedTestingLocalState(TestingBrowserProcess::GetGlobal())); | 76 new ScopedTestingLocalState(TestingBrowserProcess::GetGlobal())); |
| 78 | 77 |
| 79 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 78 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 80 TestingBrowserProcess::GetGlobal()->SetProfileManager( | 79 TestingBrowserProcess::GetGlobal()->SetProfileManager( |
| 81 new UnittestProfileManager(temp_dir_.path())); | 80 new UnittestProfileManager(temp_dir_.path())); |
| 82 | 81 |
| 83 chromeos::FakeDBusThreadManager* dbus_manager = | 82 chromeos::DBusThreadManager::Initialize(); |
| 84 new chromeos::FakeDBusThreadManager(); | |
| 85 chromeos::DBusThreadManager::InitializeForTesting(dbus_manager); | |
| 86 | 83 |
| 87 ResetUserManager(); | 84 ResetUserManager(); |
| 88 } | 85 } |
| 89 | 86 |
| 90 virtual void TearDown() OVERRIDE { | 87 virtual void TearDown() OVERRIDE { |
| 91 // Unregister the in-memory local settings instance. | 88 // Unregister the in-memory local settings instance. |
| 92 local_state_.reset(); | 89 local_state_.reset(); |
| 93 | 90 |
| 94 // Restore the real DeviceSettingsProvider. | 91 // Restore the real DeviceSettingsProvider. |
| 95 EXPECT_TRUE( | 92 EXPECT_TRUE( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 "user0@invalid.domain", "user0@invalid.domain", false); | 214 "user0@invalid.domain", "user0@invalid.domain", false); |
| 218 ResetUserManager(); | 215 ResetUserManager(); |
| 219 | 216 |
| 220 const user_manager::UserList* users = | 217 const user_manager::UserList* users = |
| 221 &user_manager::UserManager::Get()->GetUsers(); | 218 &user_manager::UserManager::Get()->GetUsers(); |
| 222 EXPECT_EQ(1U, users->size()); | 219 EXPECT_EQ(1U, users->size()); |
| 223 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); | 220 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); |
| 224 } | 221 } |
| 225 | 222 |
| 226 } // namespace chromeos | 223 } // namespace chromeos |
| OLD | NEW |