| 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "chrome/browser/chromeos/login/helper.h" | 6 #include "chrome/browser/chromeos/login/helper.h" |
| 7 #include "chrome/browser/chromeos/login/screens/mock_screen_observer.h" | 7 #include "chrome/browser/chromeos/login/screens/mock_screen_observer.h" |
| 8 #include "chrome/browser/chromeos/login/screens/network_screen.h" | 8 #include "chrome/browser/chromeos/login/screens/network_screen.h" |
| 9 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/wizard_screen.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 FakeSessionManagerClient* fake_session_manager_client_; | 110 FakeSessionManagerClient* fake_session_manager_client_; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 DISALLOW_COPY_AND_ASSIGN(NetworkScreenTest); | 113 DISALLOW_COPY_AND_ASSIGN(NetworkScreenTest); |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CanConnect) { | 116 IN_PROC_BROWSER_TEST_F(NetworkScreenTest, CanConnect) { |
| 117 EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) | 117 EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) |
| 118 .WillOnce((Return(true))); | 118 .WillOnce((Return(true))); |
| 119 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 119 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 120 network_screen_->NetworkManagerChanged(); | 120 network_screen_->UpdateStatus(); |
| 121 | 121 |
| 122 EXPECT_CALL(*mock_network_state_helper_, IsConnected()) | 122 EXPECT_CALL(*mock_network_state_helper_, IsConnected()) |
| 123 .Times(2) | 123 .Times(2) |
| 124 .WillRepeatedly(Return(true)); | 124 .WillRepeatedly(Return(true)); |
| 125 // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 | 125 // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 |
| 126 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 126 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 127 // EXPECT_FALSE(actor_->IsConnecting()); | 127 // EXPECT_FALSE(actor_->IsConnecting()); |
| 128 network_screen_->NetworkManagerChanged(); | 128 network_screen_->UpdateStatus(); |
| 129 | 129 |
| 130 // EXPECT_TRUE(actor_->IsContinueEnabled()); | 130 // EXPECT_TRUE(actor_->IsContinueEnabled()); |
| 131 EmulateContinueButtonExit(network_screen_); | 131 EmulateContinueButtonExit(network_screen_); |
| 132 EXPECT_EQ( | 132 EXPECT_EQ( |
| 133 1, fake_session_manager_client_->emit_login_prompt_ready_call_count()); | 133 1, fake_session_manager_client_->emit_login_prompt_ready_call_count()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 IN_PROC_BROWSER_TEST_F(NetworkScreenTest, Timeout) { | 136 IN_PROC_BROWSER_TEST_F(NetworkScreenTest, Timeout) { |
| 137 EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) | 137 EXPECT_CALL(*mock_network_state_helper_, IsConnecting()) |
| 138 .WillOnce((Return(true))); | 138 .WillOnce((Return(true))); |
| 139 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 139 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 140 network_screen_->NetworkManagerChanged(); | 140 network_screen_->UpdateStatus(); |
| 141 | 141 |
| 142 EXPECT_CALL(*mock_network_state_helper_, IsConnected()) | 142 EXPECT_CALL(*mock_network_state_helper_, IsConnected()) |
| 143 .Times(2) | 143 .Times(2) |
| 144 .WillRepeatedly(Return(false)); | 144 .WillRepeatedly(Return(false)); |
| 145 // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 | 145 // TODO(nkostylev): Add integration with WebUI actor http://crosbug.com/22570 |
| 146 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 146 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 147 // EXPECT_FALSE(actor_->IsConnecting()); | 147 // EXPECT_FALSE(actor_->IsConnecting()); |
| 148 network_screen_->OnConnectionTimeout(); | 148 network_screen_->OnConnectionTimeout(); |
| 149 | 149 |
| 150 // Close infobubble with error message - it makes the test stable. | 150 // Close infobubble with error message - it makes the test stable. |
| 151 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 151 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 152 // EXPECT_FALSE(actor_->IsConnecting()); | 152 // EXPECT_FALSE(actor_->IsConnecting()); |
| 153 // actor_->ClearErrors(); | 153 // actor_->ClearErrors(); |
| 154 EXPECT_EQ( | 154 EXPECT_EQ( |
| 155 1, fake_session_manager_client_->emit_login_prompt_ready_call_count()); | 155 1, fake_session_manager_client_->emit_login_prompt_ready_call_count()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace chromeos | 158 } // namespace chromeos |
| OLD | NEW |