Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: chrome/browser/chromeos/system/device_disabling_browsertest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <memory>
5 #include <string> 6 #include <string>
6 7
7 #include "base/bind.h" 8 #include "base/bind.h"
8 #include "base/logging.h" 9 #include "base/logging.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h" 13 #include "chrome/browser/chromeos/login/test/oobe_base_test.h"
14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
15 #include "chrome/browser/chromeos/login/ui/login_display_host.h" 15 #include "chrome/browser/chromeos/login/ui/login_display_host.h"
16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" 16 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
17 #include "chrome/browser/chromeos/login/wizard_controller.h" 17 #include "chrome/browser/chromeos/login/wizard_controller.h"
18 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 18 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
19 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" 19 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
20 #include "chrome/browser/chromeos/profiles/profile_helper.h" 20 #include "chrome/browser/chromeos/profiles/profile_helper.h"
21 #include "chrome/browser/chromeos/settings/cros_settings.h" 21 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 }; 76 };
77 77
78 78
79 DeviceDisablingTest::DeviceDisablingTest() 79 DeviceDisablingTest::DeviceDisablingTest()
80 : fake_session_manager_client_(new FakeSessionManagerClient) { 80 : fake_session_manager_client_(new FakeSessionManagerClient) {
81 } 81 }
82 82
83 void DeviceDisablingTest::MarkDisabledAndWaitForPolicyFetch() { 83 void DeviceDisablingTest::MarkDisabledAndWaitForPolicyFetch() {
84 base::RunLoop run_loop; 84 base::RunLoop run_loop;
85 // Set up an |observer| that will wait for the disabled setting to change. 85 // Set up an |observer| that will wait for the disabled setting to change.
86 scoped_ptr<CrosSettings::ObserverSubscription> observer = 86 std::unique_ptr<CrosSettings::ObserverSubscription> observer =
87 CrosSettings::Get()->AddSettingsObserver( 87 CrosSettings::Get()->AddSettingsObserver(kDeviceDisabled,
88 kDeviceDisabled, 88 run_loop.QuitClosure());
89 run_loop.QuitClosure());
90 // Prepare a policy fetch response that indicates the device is disabled. 89 // Prepare a policy fetch response that indicates the device is disabled.
91 test_helper_.device_policy()->policy_data().mutable_device_state()-> 90 test_helper_.device_policy()->policy_data().mutable_device_state()->
92 set_device_mode(enterprise_management::DeviceState::DEVICE_MODE_DISABLED); 91 set_device_mode(enterprise_management::DeviceState::DEVICE_MODE_DISABLED);
93 test_helper_.device_policy()->Build(); 92 test_helper_.device_policy()->Build();
94 fake_session_manager_client_->set_device_policy( 93 fake_session_manager_client_->set_device_policy(
95 test_helper_.device_policy()->GetBlob()); 94 test_helper_.device_policy()->GetBlob());
96 // Trigger a policy fetch. 95 // Trigger a policy fetch.
97 fake_session_manager_client_->OnPropertyChangeComplete(true); 96 fake_session_manager_client_->OnPropertyChangeComplete(true);
98 // Wait for the policy fetch to complete and the disabled setting to change. 97 // Wait for the policy fetch to complete and the disabled setting to change.
99 run_loop.Run(); 98 run_loop.Run();
100 } 99 }
101 100
102 std::string DeviceDisablingTest::GetCurrentScreenName( 101 std::string DeviceDisablingTest::GetCurrentScreenName(
103 content::WebContents* web_contents ) { 102 content::WebContents* web_contents ) {
104 std::string screen_name; 103 std::string screen_name;
105 if (!content::ExecuteScriptAndExtractString( 104 if (!content::ExecuteScriptAndExtractString(
106 web_contents, 105 web_contents,
107 "domAutomationController.send(Oobe.getInstance().currentScreen.id);", 106 "domAutomationController.send(Oobe.getInstance().currentScreen.id);",
108 &screen_name)) { 107 &screen_name)) {
109 ADD_FAILURE(); 108 ADD_FAILURE();
110 } 109 }
111 return screen_name; 110 return screen_name;
112 } 111 }
113 112
114 void DeviceDisablingTest::SetUpInProcessBrowserTestFixture() { 113 void DeviceDisablingTest::SetUpInProcessBrowserTestFixture() {
115 OobeBaseTest::SetUpInProcessBrowserTestFixture(); 114 OobeBaseTest::SetUpInProcessBrowserTestFixture();
116 115
117 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( 116 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient(
118 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); 117 std::unique_ptr<SessionManagerClient>(fake_session_manager_client_));
119 118
120 test_helper_.InstallOwnerKey(); 119 test_helper_.InstallOwnerKey();
121 test_helper_.MarkAsEnterpriseOwned(); 120 test_helper_.MarkAsEnterpriseOwned();
122 } 121 }
123 122
124 void DeviceDisablingTest::SetUpOnMainThread() { 123 void DeviceDisablingTest::SetUpOnMainThread() {
125 OobeBaseTest::SetUpOnMainThread(); 124 OobeBaseTest::SetUpOnMainThread();
126 125
127 // Set up fake networks. 126 // Set up fake networks.
128 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> 127 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()->
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 base::RunLoop().RunUntilIdle(); 211 base::RunLoop().RunUntilIdle();
213 212
214 // Verify that the offline error screen was not shown and the device disabled 213 // Verify that the offline error screen was not shown and the device disabled
215 // screen is still being shown instead. 214 // screen is still being shown instead.
216 EXPECT_EQ(GetOobeScreenName(OobeScreen::SCREEN_DEVICE_DISABLED), 215 EXPECT_EQ(GetOobeScreenName(OobeScreen::SCREEN_DEVICE_DISABLED),
217 GetCurrentScreenName(web_contents)); 216 GetCurrentScreenName(web_contents));
218 } 217 }
219 218
220 } // namespace system 219 } // namespace system
221 } // namespace chromeos 220 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698