| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/time.h" | 6 #include "base/time.h" |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 9 #include "chrome/browser/profile_manager.h" | 9 #include "chrome/browser/profile_manager.h" |
| 10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
| 11 #include "chrome/browser/chromeos/cros/mock_language_library.h" | 11 #include "chrome/browser/chromeos/cros/mock_language_library.h" |
| 12 #include "chrome/browser/chromeos/cros/mock_library_loader.h" | 12 #include "chrome/browser/chromeos/cros/mock_library_loader.h" |
| 13 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 13 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
| 14 #include "chrome/browser/chromeos/cros/mock_power_library.h" | 14 #include "chrome/browser/chromeos/cros/mock_power_library.h" |
| 15 #include "chrome/browser/chromeos/cros/mock_screen_lock_library.h" |
| 15 #include "chrome/browser/chromeos/cros/mock_synaptics_library.h" | 16 #include "chrome/browser/chromeos/cros/mock_synaptics_library.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/test/in_process_browser_test.h" | 18 #include "chrome/test/in_process_browser_test.h" |
| 18 #include "chrome/test/ui_test_utils.h" | 19 #include "chrome/test/ui_test_utils.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 using ::testing::_; | 24 using ::testing::_; |
| 24 using ::testing::Return; | 25 using ::testing::Return; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 .WillOnce((ReturnRef(ime_properties_))); | 41 .WillOnce((ReturnRef(ime_properties_))); |
| 41 | 42 |
| 42 testApi_->SetNetworkLibrary(&mock_network_library_, false); | 43 testApi_->SetNetworkLibrary(&mock_network_library_, false); |
| 43 | 44 |
| 44 testApi_->SetPowerLibrary(&mock_power_library_, false); | 45 testApi_->SetPowerLibrary(&mock_power_library_, false); |
| 45 EXPECT_CALL(mock_power_library_, battery_time_to_empty()) | 46 EXPECT_CALL(mock_power_library_, battery_time_to_empty()) |
| 46 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(42)))); | 47 .WillRepeatedly((Return(base::TimeDelta::FromMinutes(42)))); |
| 47 | 48 |
| 48 testApi_->SetSynapticsLibrary(&mock_synaptics_library_, false); | 49 testApi_->SetSynapticsLibrary(&mock_synaptics_library_, false); |
| 49 testApi_->SetCryptohomeLibrary(&mock_cryptohome_library_, false); | 50 testApi_->SetCryptohomeLibrary(&mock_cryptohome_library_, false); |
| 51 testApi_->SetScreenLockLibrary(&mock_screen_lock_library_, false); |
| 50 } | 52 } |
| 51 | 53 |
| 52 protected: | 54 protected: |
| 53 NiceMock<MockLibraryLoader> loader_; | 55 NiceMock<MockLibraryLoader> loader_; |
| 54 NiceMock<MockCryptohomeLibrary> mock_cryptohome_library_; | 56 NiceMock<MockCryptohomeLibrary> mock_cryptohome_library_; |
| 55 NiceMock<MockLanguageLibrary> mock_language_library_; | 57 NiceMock<MockLanguageLibrary> mock_language_library_; |
| 56 NiceMock<MockNetworkLibrary> mock_network_library_; | 58 NiceMock<MockNetworkLibrary> mock_network_library_; |
| 57 NiceMock<MockPowerLibrary> mock_power_library_; | 59 NiceMock<MockPowerLibrary> mock_power_library_; |
| 60 NiceMock<MockScreenLockLibrary> mock_screen_lock_library_; |
| 58 NiceMock<MockSynapticsLibrary> mock_synaptics_library_; | 61 NiceMock<MockSynapticsLibrary> mock_synaptics_library_; |
| 59 ImePropertyList ime_properties_; | 62 ImePropertyList ime_properties_; |
| 60 chromeos::CrosLibrary::TestApi* testApi_; | 63 chromeos::CrosLibrary::TestApi* testApi_; |
| 61 }; | 64 }; |
| 62 | 65 |
| 63 class LoginUserTest : public LoginTestBase { | 66 class LoginUserTest : public LoginTestBase { |
| 64 public: | 67 public: |
| 65 LoginUserTest() { | 68 LoginUserTest() { |
| 66 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) | 69 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) |
| 67 .WillRepeatedly(Return(true)); | 70 .WillRepeatedly(Return(true)); |
| 71 EXPECT_CALL(mock_screen_lock_library_, AddObserver(_)) |
| 72 .WillOnce(Return()); |
| 68 } | 73 } |
| 69 | 74 |
| 70 virtual void SetUpCommandLine(CommandLine* command_line) { | 75 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 71 command_line->AppendSwitchWithValue( | 76 command_line->AppendSwitchWithValue( |
| 72 switches::kLoginUser, "TestUser@gmail.com"); | 77 switches::kLoginUser, "TestUser@gmail.com"); |
| 73 command_line->AppendSwitchWithValue(switches::kLoginProfile, "user"); | 78 command_line->AppendSwitchWithValue(switches::kLoginProfile, "user"); |
| 74 command_line->AppendSwitch(switches::kNoFirstRun); | 79 command_line->AppendSwitch(switches::kNoFirstRun); |
| 75 } | 80 } |
| 76 }; | 81 }; |
| 77 | 82 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 100 // On initial launch, we should get the OTR default profile. | 105 // On initial launch, we should get the OTR default profile. |
| 101 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { | 106 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { |
| 102 Profile* profile = browser()->profile(); | 107 Profile* profile = browser()->profile(); |
| 103 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); | 108 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); |
| 104 EXPECT_TRUE(profile->IsOffTheRecord()); | 109 EXPECT_TRUE(profile->IsOffTheRecord()); |
| 105 // Ensure there's no extension service for this profile. | 110 // Ensure there's no extension service for this profile. |
| 106 EXPECT_EQ(NULL, profile->GetExtensionsService()); | 111 EXPECT_EQ(NULL, profile->GetExtensionsService()); |
| 107 } | 112 } |
| 108 | 113 |
| 109 } // namespace chromeos | 114 } // namespace chromeos |
| 110 | |
| OLD | NEW |