| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/chromeos/login/screens/mock_error_screen.h" | 9 #include "chrome/browser/chromeos/login/screens/mock_error_screen.h" |
| 10 #include "chrome/browser/chromeos/login/screens/mock_screen_observer.h" | 10 #include "chrome/browser/chromeos/login/screens/mock_screen_observer.h" |
| 11 #include "chrome/browser/chromeos/login/screens/update_screen.h" | 11 #include "chrome/browser/chromeos/login/screens/update_screen.h" |
| 12 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 13 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" | 13 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" |
| 14 #include "chrome/browser/chromeos/login/wizard_controller.h" | 14 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 15 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 15 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 16 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
| 18 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 19 #include "chromeos/dbus/fake_update_engine_client.h" | 19 #include "chromeos/dbus/fake_update_engine_client.h" |
| 20 #include "chromeos/network/portal_detector/network_portal_detector.h" | 20 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using ::testing::AnyNumber; | 24 using ::testing::AnyNumber; |
| 25 using ::testing::AtLeast; | 25 using ::testing::AtLeast; |
| 26 using ::testing::Exactly; | 26 using ::testing::Exactly; |
| 27 using ::testing::Invoke; | 27 using ::testing::Invoke; |
| 28 using ::testing::Return; | 28 using ::testing::Return; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 class UpdateScreenTest : public WizardInProcessBrowserTest { | 40 class UpdateScreenTest : public WizardInProcessBrowserTest { |
| 41 public: | 41 public: |
| 42 UpdateScreenTest() : WizardInProcessBrowserTest("update"), | 42 UpdateScreenTest() : WizardInProcessBrowserTest("update"), |
| 43 fake_update_engine_client_(NULL), | 43 fake_update_engine_client_(NULL), |
| 44 network_portal_detector_(NULL) { | 44 network_portal_detector_(NULL) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 48 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 49 FakeDBusThreadManager* fake_dbus_thread_manager = | |
| 50 new FakeDBusThreadManager; | |
| 51 fake_dbus_thread_manager->SetFakeClients(); | |
| 52 fake_update_engine_client_ = new FakeUpdateEngineClient; | 49 fake_update_engine_client_ = new FakeUpdateEngineClient; |
| 53 fake_dbus_thread_manager->SetUpdateEngineClient( | 50 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( |
| 54 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_)); | 51 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_)); |
| 55 | 52 |
| 56 DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager); | |
| 57 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 53 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 58 | 54 |
| 59 // Setup network portal detector to return online state for both | 55 // Setup network portal detector to return online state for both |
| 60 // ethernet and wifi networks. Ethernet is an active network by | 56 // ethernet and wifi networks. Ethernet is an active network by |
| 61 // default. | 57 // default. |
| 62 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); | 58 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); |
| 63 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); | 59 NetworkPortalDetector::InitializeForTesting(network_portal_detector_); |
| 64 NetworkPortalDetector::CaptivePortalState online_state; | 60 NetworkPortalDetector::CaptivePortalState online_state; |
| 65 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; | 61 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; |
| 66 online_state.response_code = 204; | 62 online_state.response_code = 204; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); | 392 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); |
| 397 EXPECT_CALL(*mock_screen_observer_, | 393 EXPECT_CALL(*mock_screen_observer_, |
| 398 OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE)) | 394 OnExit(ScreenObserver::UPDATE_ERROR_CHECKING_FOR_UPDATE)) |
| 399 .Times(1); | 395 .Times(1); |
| 400 | 396 |
| 401 update_screen_->OnConnectToNetworkRequested(); | 397 update_screen_->OnConnectToNetworkRequested(); |
| 402 base::MessageLoop::current()->RunUntilIdle(); | 398 base::MessageLoop::current()->RunUntilIdle(); |
| 403 } | 399 } |
| 404 | 400 |
| 405 } // namespace chromeos | 401 } // namespace chromeos |
| OLD | NEW |