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/test/wizard_in_process_browser_test.h" | 10 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" |
11 #include "chrome/browser/chromeos/login/wizard_controller.h" | 11 #include "chrome/browser/chromeos/login/wizard_controller.h" |
12 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
13 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
14 #include "chromeos/dbus/fake_session_manager_client.h" | 14 #include "chromeos/dbus/fake_session_manager_client.h" |
15 #include "content/public/test/test_utils.h" | 15 #include "content/public/test/test_utils.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/cros_system_api/dbus/service_constants.h" | 18 #include "third_party/cros_system_api/dbus/service_constants.h" |
19 #include "ui/views/controls/button/button.h" | 19 #include "ui/views/controls/button/button.h" |
20 | 20 |
21 using ::testing::_; | 21 using ::testing::_; |
22 using ::testing::AnyNumber; | 22 using ::testing::AnyNumber; |
23 using ::testing::Return; | 23 using ::testing::Return; |
(...skipping 22 matching lines...) Expand all Loading... |
46 class NetworkScreenTest : public WizardInProcessBrowserTest { | 46 class NetworkScreenTest : public WizardInProcessBrowserTest { |
47 public: | 47 public: |
48 NetworkScreenTest(): WizardInProcessBrowserTest("network"), | 48 NetworkScreenTest(): WizardInProcessBrowserTest("network"), |
49 fake_session_manager_client_(NULL) { | 49 fake_session_manager_client_(NULL) { |
50 } | 50 } |
51 | 51 |
52 protected: | 52 protected: |
53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
54 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 54 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
55 | 55 |
56 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; | |
57 fake_dbus_thread_manager->SetFakeClients(); | |
58 fake_session_manager_client_ = new FakeSessionManagerClient; | 56 fake_session_manager_client_ = new FakeSessionManagerClient; |
59 fake_dbus_thread_manager->SetSessionManagerClient( | 57 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
60 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); | 58 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); |
61 DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager); | |
62 } | 59 } |
63 | 60 |
64 virtual void SetUpOnMainThread() OVERRIDE { | 61 virtual void SetUpOnMainThread() OVERRIDE { |
65 WizardInProcessBrowserTest::SetUpOnMainThread(); | 62 WizardInProcessBrowserTest::SetUpOnMainThread(); |
66 mock_screen_observer_.reset(new MockScreenObserver()); | 63 mock_screen_observer_.reset(new MockScreenObserver()); |
67 ASSERT_TRUE(WizardController::default_controller() != NULL); | 64 ASSERT_TRUE(WizardController::default_controller() != NULL); |
68 network_screen_ = | 65 network_screen_ = |
69 WizardController::default_controller()->GetNetworkScreen(); | 66 WizardController::default_controller()->GetNetworkScreen(); |
70 ASSERT_TRUE(network_screen_ != NULL); | 67 ASSERT_TRUE(network_screen_ != NULL); |
71 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 68 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // EXPECT_FALSE(actor_->IsConnecting()); | 142 // EXPECT_FALSE(actor_->IsConnecting()); |
146 network_screen_->OnConnectionTimeout(); | 143 network_screen_->OnConnectionTimeout(); |
147 | 144 |
148 // Close infobubble with error message - it makes the test stable. | 145 // Close infobubble with error message - it makes the test stable. |
149 // EXPECT_FALSE(actor_->IsContinueEnabled()); | 146 // EXPECT_FALSE(actor_->IsContinueEnabled()); |
150 // EXPECT_FALSE(actor_->IsConnecting()); | 147 // EXPECT_FALSE(actor_->IsConnecting()); |
151 // actor_->ClearErrors(); | 148 // actor_->ClearErrors(); |
152 } | 149 } |
153 | 150 |
154 } // namespace chromeos | 151 } // namespace chromeos |
OLD | NEW |