| 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 <string> | |
| 6 | |
| 7 #include "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | |
| 9 #include "base/string16.h" | |
| 10 #include "base/string_number_conversions.h" | |
| 11 #include "base/utf_string_conversions.h" | |
| 12 #include "chrome/browser/chromeos/cros/cros_library.h" | 6 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 13 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 7 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
| 14 #include "chrome/browser/chromeos/cros/network_library.h" | 8 #include "chrome/browser/chromeos/cros/network_library.h" |
| 15 #include "chrome/browser/chromeos/login/mock_screen_observer.h" | 9 #include "chrome/browser/chromeos/login/mock_screen_observer.h" |
| 16 #include "chrome/browser/chromeos/login/network_screen.h" | 10 #include "chrome/browser/chromeos/login/network_screen.h" |
| 17 #include "chrome/browser/chromeos/login/view_screen.h" | 11 #include "chrome/browser/chromeos/login/view_screen.h" |
| 18 #include "chrome/browser/chromeos/login/wizard_controller.h" | 12 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 19 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" | 13 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_screen.h" | 14 #include "chrome/browser/chromeos/login/wizard_screen.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "chromeos/dbus/mock_dbus_thread_manager.h" | 16 #include "chromeos/dbus/mock_dbus_thread_manager.h" |
| 23 #include "chromeos/dbus/mock_session_manager_client.h" | 17 #include "chromeos/dbus/mock_session_manager_client.h" |
| 24 #include "grit/generated_resources.h" | 18 #include "content/public/test/test_utils.h" |
| 25 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 27 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/views/controls/button/button.h" |
| 28 #include "ui/views/controls/button/text_button.h" | 22 |
| 23 using ::testing::_; |
| 24 using ::testing::AnyNumber; |
| 25 using ::testing::Return; |
| 26 using ::testing::ReturnRef; |
| 27 using views::Button; |
| 29 | 28 |
| 30 namespace chromeos { | 29 namespace chromeos { |
| 31 using ::testing::A; | |
| 32 using ::testing::AnyNumber; | |
| 33 using ::testing::InvokeWithoutArgs; | |
| 34 using ::testing::Return; | |
| 35 using ::testing::ReturnRef; | |
| 36 using ::testing::_; | |
| 37 using views::Button; | |
| 38 | 30 |
| 39 class DummyButtonListener : public views::ButtonListener { | 31 class DummyButtonListener : public views::ButtonListener { |
| 40 public: | 32 public: |
| 41 virtual void ButtonPressed(views::Button* sender, | 33 virtual void ButtonPressed(views::Button* sender, |
| 42 const ui::Event& event) {} | 34 const ui::Event& event) {} |
| 43 }; | 35 }; |
| 44 | 36 |
| 45 class NetworkScreenTest : public WizardInProcessBrowserTest { | 37 class NetworkScreenTest : public WizardInProcessBrowserTest { |
| 46 public: | 38 public: |
| 47 NetworkScreenTest(): WizardInProcessBrowserTest("network"), | 39 NetworkScreenTest(): WizardInProcessBrowserTest("network"), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 // these mocks will be active once status bar is initialized. | 62 // these mocks will be active once status bar is initialized. |
| 71 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) | 63 EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) |
| 72 .Times(AnyNumber()); | 64 .Times(AnyNumber()); |
| 73 EXPECT_CALL(*mock_network_library_, wifi_connected()) | 65 EXPECT_CALL(*mock_network_library_, wifi_connected()) |
| 74 .Times(1) | 66 .Times(1) |
| 75 .WillRepeatedly(Return(false)); | 67 .WillRepeatedly(Return(false)); |
| 76 EXPECT_CALL(*mock_network_library_, FindWifiDevice()) | 68 EXPECT_CALL(*mock_network_library_, FindWifiDevice()) |
| 77 .Times(AnyNumber()); | 69 .Times(AnyNumber()); |
| 78 EXPECT_CALL(*mock_network_library_, FindEthernetDevice()) | 70 EXPECT_CALL(*mock_network_library_, FindEthernetDevice()) |
| 79 .Times(AnyNumber()); | 71 .Times(AnyNumber()); |
| 72 EXPECT_CALL(*mock_network_library_, LoadOncNetworks(_, _, _, _)) |
| 73 .WillRepeatedly(Return(true)); |
| 80 | 74 |
| 81 cros_mock_->SetStatusAreaMocksExpectations(); | 75 cros_mock_->SetStatusAreaMocksExpectations(); |
| 82 | 76 |
| 83 // Override these return values, but do not set specific expectation: | 77 // Override these return values, but do not set specific expectation: |
| 84 EXPECT_CALL(*mock_network_library_, wifi_available()) | 78 EXPECT_CALL(*mock_network_library_, wifi_available()) |
| 85 .Times(AnyNumber()) | 79 .Times(AnyNumber()) |
| 86 .WillRepeatedly((Return(true))); | 80 .WillRepeatedly((Return(true))); |
| 87 EXPECT_CALL(*mock_network_library_, wifi_enabled()) | 81 EXPECT_CALL(*mock_network_library_, wifi_enabled()) |
| 88 .Times(AnyNumber()) | 82 .Times(AnyNumber()) |
| 89 .WillRepeatedly((Return(true))); | 83 .WillRepeatedly((Return(true))); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // EXPECT_FALSE(actor_->IsConnecting()); | 282 // EXPECT_FALSE(actor_->IsConnecting()); |
| 289 network_screen_->OnConnectionTimeout(); | 283 network_screen_->OnConnectionTimeout(); |
| 290 | 284 |
| 291 // Close infobubble with error message - it makes the test stable. | 285 // Close infobubble with error message - it makes the test stable. |
| 292 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 286 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
| 293 // EXPECT_FALSE(actor_->IsConnecting()); | 287 // EXPECT_FALSE(actor_->IsConnecting()); |
| 294 // actor_->ClearErrors(); | 288 // actor_->ClearErrors(); |
| 295 } | 289 } |
| 296 | 290 |
| 297 } // namespace chromeos | 291 } // namespace chromeos |
| OLD | NEW |