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> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" | 21 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" |
22 #include "chrome/browser/chromeos/login/wizard_screen.h" | 22 #include "chrome/browser/chromeos/login/wizard_screen.h" |
23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
24 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
25 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
27 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
28 #include "ui/views/controls/button/text_button.h" | 28 #include "ui/views/controls/button/text_button.h" |
29 | 29 |
30 namespace chromeos { | 30 namespace chromeos { |
| 31 using ::testing::A; |
31 using ::testing::AnyNumber; | 32 using ::testing::AnyNumber; |
32 using ::testing::InvokeWithoutArgs; | 33 using ::testing::InvokeWithoutArgs; |
33 using ::testing::Return; | 34 using ::testing::Return; |
34 using ::testing::ReturnRef; | 35 using ::testing::ReturnRef; |
35 using ::testing::_; | 36 using ::testing::_; |
36 using ::testing::A; | |
37 using views::Button; | 37 using views::Button; |
38 | 38 |
39 class DummyButtonListener : public views::ButtonListener { | 39 class DummyButtonListener : public views::ButtonListener { |
40 public: | 40 public: |
41 virtual void ButtonPressed(views::Button* sender, | 41 virtual void ButtonPressed(views::Button* sender, |
42 const views::Event& event) {} | 42 const views::Event& event) {} |
43 }; | 43 }; |
44 | 44 |
45 class NetworkScreenTest : public WizardInProcessBrowserTest { | 45 class NetworkScreenTest : public WizardInProcessBrowserTest { |
46 public: | 46 public: |
47 NetworkScreenTest(): WizardInProcessBrowserTest("network"), | 47 NetworkScreenTest(): WizardInProcessBrowserTest("network"), |
48 mock_network_library_(NULL) { | 48 mock_network_library_(NULL) { |
49 } | 49 } |
50 | 50 |
51 protected: | 51 protected: |
52 virtual void SetUpInProcessBrowserTestFixture() { | 52 virtual void SetUpInProcessBrowserTestFixture() { |
53 MockDBusThreadManager* mock_dbus_thread_manager = | 53 MockDBusThreadManager* mock_dbus_thread_manager = |
54 new MockDBusThreadManager; | 54 new MockDBusThreadManager; |
55 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); | 55 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
56 cros_mock_->InitStatusAreaMocks(); | 56 cros_mock_->InitStatusAreaMocks(); |
57 mock_network_library_ = cros_mock_->mock_network_library(); | 57 mock_network_library_ = cros_mock_->mock_network_library(); |
58 MockSessionManagerClient* mock_session_manager_client = | 58 MockSessionManagerClient* mock_session_manager_client = |
59 mock_dbus_thread_manager->mock_session_manager_client(); | 59 mock_dbus_thread_manager->mock_session_manager_client(); |
60 cellular_.reset(new NetworkDevice("cellular")); | 60 cellular_.reset(new NetworkDevice("cellular")); |
61 EXPECT_CALL(*mock_session_manager_client, EmitLoginPromptReady()) | 61 EXPECT_CALL(*mock_session_manager_client, EmitLoginPromptReady()) |
62 .Times(1); | 62 .Times(1); |
63 EXPECT_CALL(*mock_session_manager_client, RetrievePolicy(_)) | 63 EXPECT_CALL(*mock_session_manager_client, RetrieveDevicePolicy(_)) |
64 .Times(AnyNumber()); | 64 .Times(AnyNumber()); |
65 | 65 |
66 // Minimal set of expectations needed on NetworkScreen initialization. | 66 // Minimal set of expectations needed on NetworkScreen initialization. |
67 // Status bar expectations are defined with RetiresOnSaturation() so | 67 // Status bar expectations are defined with RetiresOnSaturation() so |
68 // these mocks will be active once status bar is initialized. | 68 // these mocks will be active once status bar is initialized. |
69 EXPECT_CALL(*mock_network_library_, wifi_connected()) | 69 EXPECT_CALL(*mock_network_library_, wifi_connected()) |
70 .Times(1) | 70 .Times(1) |
71 .WillRepeatedly(Return(false)); | 71 .WillRepeatedly(Return(false)); |
72 EXPECT_CALL(*mock_network_library_, FindWifiDevice()) | 72 EXPECT_CALL(*mock_network_library_, FindWifiDevice()) |
73 .Times(AnyNumber()); | 73 .Times(AnyNumber()); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // EXPECT_FALSE(actor_->IsConnecting()); | 271 // EXPECT_FALSE(actor_->IsConnecting()); |
272 network_screen_->OnConnectionTimeout(); | 272 network_screen_->OnConnectionTimeout(); |
273 | 273 |
274 // Close infobubble with error message - it makes the test stable. | 274 // Close infobubble with error message - it makes the test stable. |
275 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 275 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
276 // EXPECT_FALSE(actor_->IsConnecting()); | 276 // EXPECT_FALSE(actor_->IsConnecting()); |
277 // actor_->ClearErrors(); | 277 // actor_->ClearErrors(); |
278 } | 278 } |
279 | 279 |
280 } // namespace chromeos | 280 } // namespace chromeos |
OLD | NEW |