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 "ash/shell.h" | 5 #include "ash/shell.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "chrome/browser/chrome_browser_main.h" | 7 #include "chrome/browser/chrome_browser_main.h" |
8 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 8 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 10 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
11 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | |
12 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 11 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
13 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 12 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
14 #include "chrome/browser/chromeos/login/login_wizard.h" | 13 #include "chrome/browser/chromeos/login/login_wizard.h" |
15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 14 #include "chrome/browser/chromeos/login/wizard_controller.h" |
16 #include "chrome/browser/extensions/extension_system.h" | 15 #include "chrome/browser/extensions/extension_system.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 16 #include "chrome/browser/profiles/profile_manager.h" |
18 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
20 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" |
21 #include "chrome/test/base/interactive_test_utils.h" | 21 #include "chrome/test/base/interactive_test_utils.h" |
22 #include "chrome/test/base/in_process_browser_test.h" | |
23 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
24 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
| 24 #include "chromeos/cryptohome/mock_cryptohome_library.h" |
25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
28 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 using ::testing::_; | 32 using ::testing::_; |
33 using ::testing::AnyNumber; | 33 using ::testing::AnyNumber; |
34 using ::testing::Return; | 34 using ::testing::Return; |
35 | 35 |
36 namespace { | 36 namespace { |
37 | 37 |
38 class LoginTestBase : public chromeos::CrosInProcessBrowserTest { | 38 class LoginTestBase : public chromeos::CrosInProcessBrowserTest { |
39 public: | 39 public: |
40 LoginTestBase() | 40 LoginTestBase() |
41 : mock_cryptohome_library_(NULL), | 41 : mock_cryptohome_library_(NULL), |
42 mock_network_library_(NULL) { | 42 mock_network_library_(NULL) { |
43 } | 43 } |
44 | 44 |
45 protected: | 45 protected: |
46 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 46 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 47 mock_cryptohome_library_.reset(new chromeos::MockCryptohomeLibrary()); |
47 cros_mock_->InitStatusAreaMocks(); | 48 cros_mock_->InitStatusAreaMocks(); |
48 cros_mock_->SetStatusAreaMocksExpectations(); | 49 cros_mock_->SetStatusAreaMocksExpectations(); |
49 cros_mock_->InitMockCryptohomeLibrary(); | |
50 mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); | |
51 mock_network_library_ = cros_mock_->mock_network_library(); | 50 mock_network_library_ = cros_mock_->mock_network_library(); |
52 EXPECT_CALL(*mock_cryptohome_library_, GetSystemSalt()) | 51 EXPECT_CALL(*(mock_cryptohome_library_.get()), GetSystemSalt()) |
53 .WillRepeatedly(Return(std::string("stub_system_salt"))); | 52 .WillRepeatedly(Return(std::string("stub_system_salt"))); |
54 EXPECT_CALL(*mock_cryptohome_library_, InstallAttributesIsReady()) | 53 EXPECT_CALL(*(mock_cryptohome_library_.get()), InstallAttributesIsReady()) |
55 .WillRepeatedly(Return(false)); | 54 .WillRepeatedly(Return(false)); |
56 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) | 55 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) |
57 .Times(AnyNumber()); | 56 .Times(AnyNumber()); |
58 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _)) | 57 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _)) |
59 .WillRepeatedly(Return(true)); | 58 .WillRepeatedly(Return(true)); |
60 } | 59 } |
61 | 60 |
62 chromeos::MockCryptohomeLibrary* mock_cryptohome_library_; | 61 scoped_ptr<chromeos::MockCryptohomeLibrary> mock_cryptohome_library_; |
63 chromeos::MockNetworkLibrary* mock_network_library_; | 62 chromeos::MockNetworkLibrary* mock_network_library_; |
64 | 63 |
65 private: | 64 private: |
66 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); | 65 DISALLOW_COPY_AND_ASSIGN(LoginTestBase); |
67 }; | 66 }; |
68 | 67 |
69 class LoginUserTest : public LoginTestBase { | 68 class LoginUserTest : public LoginTestBase { |
70 protected: | 69 protected: |
71 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 70 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
72 LoginTestBase::SetUpInProcessBrowserTestFixture(); | 71 LoginTestBase::SetUpInProcessBrowserTestFixture(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // Verifies that the webui for login comes up successfully. | 217 // Verifies that the webui for login comes up successfully. |
219 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { | 218 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { |
220 scoped_refptr<content::MessageLoopRunner> runner = | 219 scoped_refptr<content::MessageLoopRunner> runner = |
221 new content::MessageLoopRunner; | 220 new content::MessageLoopRunner; |
222 content_browser_client_->browser_main_extra_parts_->set_quit_task( | 221 content_browser_client_->browser_main_extra_parts_->set_quit_task( |
223 runner->QuitClosure()); | 222 runner->QuitClosure()); |
224 runner->Run(); | 223 runner->Run(); |
225 } | 224 } |
226 | 225 |
227 } | 226 } |
OLD | NEW |