| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 41 command_line->AppendSwitch(::switches::kMultiProfiles); | 41 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 42 command_line->AppendSwitchASCII(switches::kLoginUser, kUserId1); | 42 command_line->AppendSwitchASCII(switches::kLoginUser, kUserId1); |
| 43 command_line->AppendSwitchASCII( | 43 command_line->AppendSwitchASCII( |
| 44 switches::kLoginProfile, | 44 switches::kLoginProfile, |
| 45 CryptohomeClient::GetStubSanitizedUsername(kUserId1)); | 45 CryptohomeClient::GetStubSanitizedUsername(kUserId1)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 49 // Redirect session_manager DBus calls to FakeSessionManagerClient. | 49 // Redirect session_manager DBus calls to FakeSessionManagerClient. |
| 50 FakeDBusThreadManager* dbus_thread_manager = | 50 FakeDBusThreadManager* dbus_thread_manager = new FakeDBusThreadManager; |
| 51 new FakeDBusThreadManager(); | 51 session_manager_client_ = new FakeSessionManagerClient; |
| 52 session_manager_client_ = | 52 dbus_thread_manager->SetSessionManagerClient( |
| 53 dbus_thread_manager->fake_session_manager_client(); | 53 scoped_ptr<SessionManagerClient>(session_manager_client_)); |
| 54 DBusThreadManager::InitializeForTesting(dbus_thread_manager); | 54 DBusThreadManager::InitializeForTesting(dbus_thread_manager); |
| 55 session_manager_client_->StartSession(kUserId1); | 55 session_manager_client_->StartSession(kUserId1); |
| 56 } | 56 } |
| 57 | 57 |
| 58 FakeSessionManagerClient* session_manager_client_; | 58 FakeSessionManagerClient* session_manager_client_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 IN_PROC_BROWSER_TEST_F(CrashRestoreSimpleTest, RestoreSessionForOneUser) { | 61 IN_PROC_BROWSER_TEST_F(CrashRestoreSimpleTest, RestoreSessionForOneUser) { |
| 62 UserManager* user_manager = UserManager::Get(); | 62 UserManager* user_manager = UserManager::Get(); |
| 63 User* user = user_manager->GetActiveUser(); | 63 User* user = user_manager->GetActiveUser(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 users[0]->username_hash()); | 147 users[0]->username_hash()); |
| 148 EXPECT_EQ(kUserId2, users[1]->email()); | 148 EXPECT_EQ(kUserId2, users[1]->email()); |
| 149 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId2), | 149 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId2), |
| 150 users[1]->username_hash()); | 150 users[1]->username_hash()); |
| 151 EXPECT_EQ(kUserId1, users[2]->email()); | 151 EXPECT_EQ(kUserId1, users[2]->email()); |
| 152 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId1), | 152 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId1), |
| 153 users[2]->username_hash()); | 153 users[2]->username_hash()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace chromeos | 156 } // namespace chromeos |
| OLD | NEW |