| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" | |
| 7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 6 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
| 8 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 7 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
| 9 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 8 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 14 #include "chrome/test/base/ui_test_utils.h" | 13 #include "chrome/test/base/ui_test_utils.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 16 |
| 18 namespace chromeos { | |
| 19 using ::testing::_; | 17 using ::testing::_; |
| 20 using ::testing::AnyNumber; | 18 using ::testing::AnyNumber; |
| 21 using ::testing::AtLeast; | |
| 22 using ::testing::Return; | 19 using ::testing::Return; |
| 23 | 20 |
| 21 namespace chromeos { |
| 22 |
| 24 class LoginTestBase : public CrosInProcessBrowserTest { | 23 class LoginTestBase : public CrosInProcessBrowserTest { |
| 25 public: | 24 public: |
| 26 LoginTestBase() | 25 LoginTestBase() |
| 27 : mock_cryptohome_library_(NULL), | 26 : mock_cryptohome_library_(NULL), |
| 28 mock_network_library_(NULL) { | 27 mock_network_library_(NULL) { |
| 29 } | 28 } |
| 30 | 29 |
| 31 protected: | 30 protected: |
| 32 virtual void SetUpInProcessBrowserTestFixture() { | 31 virtual void SetUpInProcessBrowserTestFixture() { |
| 33 cros_mock_->InitStatusAreaMocks(); | 32 cros_mock_->InitStatusAreaMocks(); |
| 34 cros_mock_->SetStatusAreaMocksExpectations(); | 33 cros_mock_->SetStatusAreaMocksExpectations(); |
| 35 cros_mock_->InitMockCryptohomeLibrary(); | 34 cros_mock_->InitMockCryptohomeLibrary(); |
| 36 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); | 35 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); |
| 37 mock_network_library_ = cros_mock_->mock_network_library(); | 36 mock_network_library_ = cros_mock_->mock_network_library(); |
| 38 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) | 37 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) |
| 39 .WillRepeatedly(Return(std::string("stub_system_salt"))); | 38 .WillRepeatedly(Return(std::string("stub_system_salt"))); |
| 39 EXPECT_CALL(*mock_cryptohome_library_, InstallAttributesIsReady()) |
| 40 .WillRepeatedly(Return(false)); |
| 40 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) | 41 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) |
| 41 .Times(AnyNumber()); | 42 .Times(AnyNumber()); |
| 43 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _)) |
| 44 .WillRepeatedly(Return(true)); |
| 42 } | 45 } |
| 43 | 46 |
| 44 MockCryptohomeLibrary* mock_cryptohome_library_; | 47 MockCryptohomeLibrary* mock_cryptohome_library_; |
| 45 MockNetworkLibrary* mock_network_library_; | 48 MockNetworkLibrary* mock_network_library_; |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); | 51 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 class LoginUserTest : public LoginTestBase { | 54 class LoginUserTest : public LoginTestBase { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // After a guest login, we should get the OTR default profile. | 86 // After a guest login, we should get the OTR default profile. |
| 84 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { | 87 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { |
| 85 Profile* profile = browser()->profile(); | 88 Profile* profile = browser()->profile(); |
| 86 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); | 89 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); |
| 87 EXPECT_TRUE(profile->IsOffTheRecord()); | 90 EXPECT_TRUE(profile->IsOffTheRecord()); |
| 88 // Ensure there's extension service for this profile. | 91 // Ensure there's extension service for this profile. |
| 89 EXPECT_TRUE(profile->GetExtensionService()); | 92 EXPECT_TRUE(profile->GetExtensionService()); |
| 90 } | 93 } |
| 91 | 94 |
| 92 } // namespace chromeos | 95 } // namespace chromeos |
| OLD | NEW |