| 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" |
| 11 #include "chrome/browser/chromeos/login/users/user.h" | 11 #include "chrome/browser/chromeos/login/users/user.h" |
| 12 #include "chrome/browser/chromeos/login/users/user_manager.h" | 12 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 13 #include "chrome/common/chrome_switches.h" | |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 13 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "chromeos/chromeos_switches.h" | 14 #include "chromeos/chromeos_switches.h" |
| 16 #include "chromeos/dbus/cryptohome_client.h" | 15 #include "chromeos/dbus/cryptohome_client.h" |
| 17 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 16 #include "chromeos/dbus/fake_dbus_thread_manager.h" |
| 18 #include "chromeos/dbus/fake_session_manager_client.h" | 17 #include "chromeos/dbus/fake_session_manager_client.h" |
| 19 #include "chromeos/dbus/session_manager_client.h" | 18 #include "chromeos/dbus/session_manager_client.h" |
| 20 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "third_party/cros_system_api/dbus/service_constants.h" | 21 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 23 | 22 |
| 24 namespace chromeos { | 23 namespace chromeos { |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| 27 | 26 |
| 28 const char kUserId1[] = "user1@example.com"; | 27 const char kUserId1[] = "user1@example.com"; |
| 29 const char kUserId2[] = "user2@example.com"; | 28 const char kUserId2[] = "user2@example.com"; |
| 30 const char kUserId3[] = "user3@example.com"; | 29 const char kUserId3[] = "user3@example.com"; |
| 31 | 30 |
| 32 } // namespace | 31 } // namespace |
| 33 | 32 |
| 34 class CrashRestoreSimpleTest : public InProcessBrowserTest { | 33 class CrashRestoreSimpleTest : public InProcessBrowserTest { |
| 35 protected: | 34 protected: |
| 36 CrashRestoreSimpleTest() {} | 35 CrashRestoreSimpleTest() {} |
| 37 | 36 |
| 38 virtual ~CrashRestoreSimpleTest() {} | 37 virtual ~CrashRestoreSimpleTest() {} |
| 39 | 38 |
| 40 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 41 command_line->AppendSwitch(::switches::kMultiProfiles); | |
| 42 command_line->AppendSwitchASCII(switches::kLoginUser, kUserId1); | 40 command_line->AppendSwitchASCII(switches::kLoginUser, kUserId1); |
| 43 command_line->AppendSwitchASCII( | 41 command_line->AppendSwitchASCII( |
| 44 switches::kLoginProfile, | 42 switches::kLoginProfile, |
| 45 CryptohomeClient::GetStubSanitizedUsername(kUserId1)); | 43 CryptohomeClient::GetStubSanitizedUsername(kUserId1)); |
| 46 } | 44 } |
| 47 | 45 |
| 48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 46 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 49 // Redirect session_manager DBus calls to FakeSessionManagerClient. | 47 // Redirect session_manager DBus calls to FakeSessionManagerClient. |
| 50 FakeDBusThreadManager* dbus_thread_manager = new FakeDBusThreadManager; | 48 FakeDBusThreadManager* dbus_thread_manager = new FakeDBusThreadManager; |
| 51 dbus_thread_manager->SetFakeClients(); | 49 dbus_thread_manager->SetFakeClients(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 users[0]->username_hash()); | 146 users[0]->username_hash()); |
| 149 EXPECT_EQ(kUserId2, users[1]->email()); | 147 EXPECT_EQ(kUserId2, users[1]->email()); |
| 150 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId2), | 148 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId2), |
| 151 users[1]->username_hash()); | 149 users[1]->username_hash()); |
| 152 EXPECT_EQ(kUserId1, users[2]->email()); | 150 EXPECT_EQ(kUserId1, users[2]->email()); |
| 153 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId1), | 151 EXPECT_EQ(CryptohomeClient::GetStubSanitizedUsername(kUserId1), |
| 154 users[2]->username_hash()); | 152 users[2]->username_hash()); |
| 155 } | 153 } |
| 156 | 154 |
| 157 } // namespace chromeos | 155 } // namespace chromeos |
| OLD | NEW |