| 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
| 6 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 6 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 7 #include "chrome/browser/chromeos/login/login_manager_test.h" | 7 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 8 #include "chrome/browser/chromeos/login/multi_profile_user_controller.h" | 8 #include "chrome/browser/chromeos/login/multi_profile_user_controller.h" |
| 9 #include "chrome/browser/chromeos/login/startup_utils.h" | 9 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 10 #include "chrome/browser/chromeos/login/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/user_adding_screen.h" |
| 11 #include "chrome/browser/chromeos/login/user_manager.h" | 11 #include "chrome/browser/chromeos/login/user_manager.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
| 15 #include "chromeos/chromeos_switches.h" | |
| 16 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 17 |
| 19 using namespace testing; | 18 using namespace testing; |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 const char* kTestUsers[] = {"test-user1@gmail.com", | 22 const char* kTestUsers[] = {"test-user1@gmail.com", |
| 24 "test-user2@gmail.com", | 23 "test-user2@gmail.com", |
| 25 "test-user3@gmail.com"}; | 24 "test-user3@gmail.com"}; |
| 26 | 25 |
| 27 } // anonymous namespace | 26 } // anonymous namespace |
| 28 | 27 |
| 29 namespace chromeos { | 28 namespace chromeos { |
| 30 | 29 |
| 31 class UserAddingScreenTest : public LoginManagerTest, | 30 class UserAddingScreenTest : public LoginManagerTest, |
| 32 public UserAddingScreen::Observer { | 31 public UserAddingScreen::Observer { |
| 33 public: | 32 public: |
| 34 UserAddingScreenTest() : LoginManagerTest(false), | 33 UserAddingScreenTest() : LoginManagerTest(false), |
| 35 user_adding_started_(0), | 34 user_adding_started_(0), |
| 36 user_adding_finished_(0) { | 35 user_adding_finished_(0) { |
| 37 } | 36 } |
| 38 | 37 |
| 39 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 38 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 40 LoginManagerTest::SetUpCommandLine(command_line); | 39 LoginManagerTest::SetUpCommandLine(command_line); |
| 41 command_line->AppendSwitch(::switches::kMultiProfiles); | 40 command_line->AppendSwitch(::switches::kMultiProfiles); |
| 42 command_line->AppendSwitch(switches::kForceMultiProfileInTests); | |
| 43 } | 41 } |
| 44 | 42 |
| 45 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 43 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 46 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 44 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
| 47 UserAddingScreen::Get()->AddObserver(this); | 45 UserAddingScreen::Get()->AddObserver(this); |
| 48 } | 46 } |
| 49 | 47 |
| 50 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; } | 48 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; } |
| 51 | 49 |
| 52 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; } | 50 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // not be listed on screen lock. | 174 // not be listed on screen lock. |
| 177 prefs3->SetString(prefs::kMultiProfileUserBehavior, | 175 prefs3->SetString(prefs::kMultiProfileUserBehavior, |
| 178 MultiProfileUserController::kBehaviorNotAllowed); | 176 MultiProfileUserController::kBehaviorNotAllowed); |
| 179 unlock_users = user_manager->GetUnlockUsers(); | 177 unlock_users = user_manager->GetUnlockUsers(); |
| 180 ASSERT_EQ(2UL, unlock_users.size()); | 178 ASSERT_EQ(2UL, unlock_users.size()); |
| 181 for (int i = 0; i < 2; ++i) | 179 for (int i = 0; i < 2; ++i) |
| 182 EXPECT_EQ(kTestUsers[i], unlock_users[i]->email()); | 180 EXPECT_EQ(kTestUsers[i], unlock_users[i]->email()); |
| 183 } | 181 } |
| 184 | 182 |
| 185 } // namespace chromeos | 183 } // namespace chromeos |
| OLD | NEW |