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 "chrome/browser/chromeos/login/screens/update_screen.h" |
| 6 |
| 7 #include <memory> |
| 8 |
5 #include "base/command_line.h" | 9 #include "base/command_line.h" |
6 #include "base/macros.h" | 10 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | |
8 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/chromeos/login/screens/mock_base_screen_delegate.h" | 12 #include "chrome/browser/chromeos/login/screens/mock_base_screen_delegate.h" |
10 #include "chrome/browser/chromeos/login/screens/mock_error_screen.h" | 13 #include "chrome/browser/chromeos/login/screens/mock_error_screen.h" |
11 #include "chrome/browser/chromeos/login/screens/network_error.h" | 14 #include "chrome/browser/chromeos/login/screens/network_error.h" |
12 #include "chrome/browser/chromeos/login/screens/update_screen.h" | |
13 #include "chrome/browser/chromeos/login/startup_utils.h" | 15 #include "chrome/browser/chromeos/login/startup_utils.h" |
14 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" | 16 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" |
15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 17 #include "chrome/browser/chromeos/login/wizard_controller.h" |
16 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 18 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
17 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
18 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 21 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/dbus/fake_update_engine_client.h" | 22 #include "chromeos/dbus/fake_update_engine_client.h" |
21 #include "chromeos/network/portal_detector/network_portal_detector.h" | 23 #include "chromeos/network/portal_detector/network_portal_detector.h" |
22 #include "components/prefs/pref_service.h" | 24 #include "components/prefs/pref_service.h" |
(...skipping 20 matching lines...) Expand all Loading... |
43 public: | 45 public: |
44 UpdateScreenTest() : WizardInProcessBrowserTest("update"), | 46 UpdateScreenTest() : WizardInProcessBrowserTest("update"), |
45 fake_update_engine_client_(NULL), | 47 fake_update_engine_client_(NULL), |
46 network_portal_detector_(NULL) { | 48 network_portal_detector_(NULL) { |
47 } | 49 } |
48 | 50 |
49 protected: | 51 protected: |
50 void SetUpInProcessBrowserTestFixture() override { | 52 void SetUpInProcessBrowserTestFixture() override { |
51 fake_update_engine_client_ = new FakeUpdateEngineClient; | 53 fake_update_engine_client_ = new FakeUpdateEngineClient; |
52 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( | 54 chromeos::DBusThreadManager::GetSetterForTesting()->SetUpdateEngineClient( |
53 scoped_ptr<UpdateEngineClient>(fake_update_engine_client_)); | 55 std::unique_ptr<UpdateEngineClient>(fake_update_engine_client_)); |
54 | 56 |
55 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 57 WizardInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
56 | 58 |
57 // Setup network portal detector to return online state for both | 59 // Setup network portal detector to return online state for both |
58 // ethernet and wifi networks. Ethernet is an active network by | 60 // ethernet and wifi networks. Ethernet is an active network by |
59 // default. | 61 // default. |
60 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); | 62 network_portal_detector_ = new NetworkPortalDetectorTestImpl(); |
61 network_portal_detector::InitializeForTesting(network_portal_detector_); | 63 network_portal_detector::InitializeForTesting(network_portal_detector_); |
62 NetworkPortalDetector::CaptivePortalState online_state; | 64 NetworkPortalDetector::CaptivePortalState online_state; |
63 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; | 65 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 DCHECK(network_portal_detector_); | 112 DCHECK(network_portal_detector_); |
111 network_portal_detector_->SetDetectionResultsForTesting(guid, state); | 113 network_portal_detector_->SetDetectionResultsForTesting(guid, state); |
112 } | 114 } |
113 | 115 |
114 void NotifyPortalDetectionCompleted() { | 116 void NotifyPortalDetectionCompleted() { |
115 DCHECK(network_portal_detector_); | 117 DCHECK(network_portal_detector_); |
116 network_portal_detector_->NotifyObserversForTesting(); | 118 network_portal_detector_->NotifyObserversForTesting(); |
117 } | 119 } |
118 | 120 |
119 FakeUpdateEngineClient* fake_update_engine_client_; | 121 FakeUpdateEngineClient* fake_update_engine_client_; |
120 scoped_ptr<MockBaseScreenDelegate> mock_base_screen_delegate_; | 122 std::unique_ptr<MockBaseScreenDelegate> mock_base_screen_delegate_; |
121 scoped_ptr<MockNetworkErrorView> mock_network_error_view_; | 123 std::unique_ptr<MockNetworkErrorView> mock_network_error_view_; |
122 scoped_ptr<MockErrorScreen> mock_error_screen_; | 124 std::unique_ptr<MockErrorScreen> mock_error_screen_; |
123 UpdateScreen* update_screen_; | 125 UpdateScreen* update_screen_; |
124 NetworkPortalDetectorTestImpl* network_portal_detector_; | 126 NetworkPortalDetectorTestImpl* network_portal_detector_; |
125 | 127 |
126 private: | 128 private: |
127 DISALLOW_COPY_AND_ASSIGN(UpdateScreenTest); | 129 DISALLOW_COPY_AND_ASSIGN(UpdateScreenTest); |
128 }; | 130 }; |
129 | 131 |
130 IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestBasic) { | 132 IN_PROC_BROWSER_TEST_F(UpdateScreenTest, TestBasic) { |
131 ASSERT_TRUE(update_screen_->view_ != NULL); | 133 ASSERT_TRUE(update_screen_->view_ != NULL); |
132 } | 134 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); | 400 chromeos::UpdateEngineClient::UPDATE_RESULT_FAILED); |
399 EXPECT_CALL(*mock_base_screen_delegate_, | 401 EXPECT_CALL(*mock_base_screen_delegate_, |
400 OnExit(_, BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE, | 402 OnExit(_, BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE, |
401 _)).Times(1); | 403 _)).Times(1); |
402 | 404 |
403 update_screen_->OnConnectRequested(); | 405 update_screen_->OnConnectRequested(); |
404 base::MessageLoop::current()->RunUntilIdle(); | 406 base::MessageLoop::current()->RunUntilIdle(); |
405 } | 407 } |
406 | 408 |
407 } // namespace chromeos | 409 } // namespace chromeos |
OLD | NEW |