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