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

Side by Side Diff: chrome/browser/chromeos/policy/blocking_login_browsertest.cc

Issue 1112843003: Revert "Enable BlockingLoginTest, ForceMaximizeOnFirstRunTest, UserCloudPolicyManagerTest, for webv… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 *out = result; 71 *out = result;
72 loop->Quit(); 72 loop->Quit();
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 76
77 struct BlockingLoginTestParam { 77 struct BlockingLoginTestParam {
78 const int steps; 78 const int steps;
79 const char* username; 79 const char* username;
80 const bool enroll_device; 80 const bool enroll_device;
81 const bool use_webview;
82 }; 81 };
83 82
84 class BlockingLoginTest 83 class BlockingLoginTest
85 : public OobeBaseTest, 84 : public OobeBaseTest,
86 public content::NotificationObserver, 85 public content::NotificationObserver,
87 public testing::WithParamInterface<BlockingLoginTestParam> { 86 public testing::WithParamInterface<BlockingLoginTestParam> {
88 public: 87 public:
89 BlockingLoginTest() : profile_added_(NULL) { 88 BlockingLoginTest() : profile_added_(NULL) {
90 set_use_webview(GetParam().use_webview); 89 // TODO(nkostylev): Fix this test for webview. http://crbug.com/477402
90 set_use_webview(false);
91 } 91 }
92 92
93 void SetUpCommandLine(base::CommandLine* command_line) override { 93 void SetUpCommandLine(base::CommandLine* command_line) override {
94 OobeBaseTest::SetUpCommandLine(command_line); 94 OobeBaseTest::SetUpCommandLine(command_line);
95 95
96 command_line->AppendSwitchASCII(::switches::kAuthExtensionPath,
97 "gaia_auth");
96 command_line->AppendSwitchASCII( 98 command_line->AppendSwitchASCII(
97 policy::switches::kDeviceManagementUrl, 99 policy::switches::kDeviceManagementUrl,
98 embedded_test_server()->GetURL("/device_management").spec()); 100 embedded_test_server()->GetURL("/device_management").spec());
99 } 101 }
100 102
101 void SetUpOnMainThread() override { 103 void SetUpOnMainThread() override {
102 registrar_.Add(this, 104 registrar_.Add(this,
103 chrome::NOTIFICATION_PROFILE_ADDED, 105 chrome::NOTIFICATION_PROFILE_ADDED,
104 content::NotificationService::AllSources()); 106 content::NotificationService::AllSources());
105 107
(...skipping 17 matching lines...) Expand all
123 125
124 void RunUntilIdle() { 126 void RunUntilIdle() {
125 base::RunLoop().RunUntilIdle(); 127 base::RunLoop().RunUntilIdle();
126 } 128 }
127 129
128 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector() { 130 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector() {
129 return g_browser_process->platform_part() 131 return g_browser_process->platform_part()
130 ->browser_policy_connector_chromeos(); 132 ->browser_policy_connector_chromeos();
131 } 133 }
132 134
135 void SkipToSigninScreen() {
136 WizardController::SkipPostLoginScreensForTesting();
137 WizardController* wizard_controller =
138 WizardController::default_controller();
139 ASSERT_TRUE(wizard_controller);
140 wizard_controller->SkipToLoginForTesting(LoginScreenContext());
141
142 content::WindowedNotificationObserver(
143 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
144 content::NotificationService::AllSources()).Wait();
145 RunUntilIdle();
146 }
147
133 void EnrollDevice(const std::string& username) { 148 void EnrollDevice(const std::string& username) {
134 base::RunLoop loop; 149 base::RunLoop loop;
135 policy::EnterpriseInstallAttributes::LockResult result; 150 policy::EnterpriseInstallAttributes::LockResult result;
136 browser_policy_connector()->GetInstallAttributes()->LockDevice( 151 browser_policy_connector()->GetInstallAttributes()->LockDevice(
137 username, policy::DEVICE_MODE_ENTERPRISE, "100200300", 152 username, policy::DEVICE_MODE_ENTERPRISE, "100200300",
138 base::Bind(&CopyLockResult, &loop, &result)); 153 base::Bind(&CopyLockResult, &loop, &result));
139 loop.Run(); 154 loop.Run();
140 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS, result); 155 EXPECT_EQ(policy::EnterpriseInstallAttributes::LOCK_SUCCESS, result);
141 RunUntilIdle(); 156 RunUntilIdle();
142 } 157 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 EXPECT_EQ(kDomain, browser_policy_connector()->GetEnterpriseDomain()); 261 EXPECT_EQ(kDomain, browser_policy_connector()->GetEnterpriseDomain());
247 EXPECT_FALSE(profile_added_); 262 EXPECT_FALSE(profile_added_);
248 EXPECT_EQ(policy::USER_AFFILIATION_MANAGED, 263 EXPECT_EQ(policy::USER_AFFILIATION_MANAGED,
249 browser_policy_connector()->GetUserAffiliation(kUsername)); 264 browser_policy_connector()->GetUserAffiliation(kUsername));
250 RunUntilIdle(); 265 RunUntilIdle();
251 EXPECT_FALSE(user_manager->IsKnownUser(kUsername)); 266 EXPECT_FALSE(user_manager->IsKnownUser(kUsername));
252 } 267 }
253 268
254 // Skip the OOBE, go to the sign-in screen, and wait for the login screen to 269 // Skip the OOBE, go to the sign-in screen, and wait for the login screen to
255 // become visible. 270 // become visible.
256 WaitForSigninScreen(); 271 SkipToSigninScreen();
257 EXPECT_FALSE(profile_added_); 272 EXPECT_FALSE(profile_added_);
258 273
259 // Prepare the fake HTTP responses. 274 // Prepare the fake HTTP responses.
260 if (GetParam().steps < 5) { 275 if (GetParam().steps < 5) {
261 // If this instance is not going to complete the entire flow successfully 276 // If this instance is not going to complete the entire flow successfully
262 // then the last step will fail. 277 // then the last step will fail.
263 278
264 // This response body is important to make the gaia fetcher skip its delayed 279 // This response body is important to make the gaia fetcher skip its delayed
265 // retry behavior, which makes testing harder. If this is sent to the policy 280 // retry behavior, which makes testing harder. If this is sent to the policy
266 // fetchers then it will make them fail too. 281 // fetchers then it will make them fail too.
(...skipping 30 matching lines...) Expand all
297 // Login now. This verifies that logging in with the canned responses (which 312 // Login now. This verifies that logging in with the canned responses (which
298 // may include failures) won't be blocked due to the potential failures. 313 // may include failures) won't be blocked due to the potential failures.
299 EXPECT_FALSE(profile_added_); 314 EXPECT_FALSE(profile_added_);
300 Login(GetParam().username); 315 Login(GetParam().username);
301 EXPECT_TRUE(profile_added_); 316 EXPECT_TRUE(profile_added_);
302 ASSERT_TRUE(user_manager->IsUserLoggedIn()); 317 ASSERT_TRUE(user_manager->IsUserLoggedIn());
303 EXPECT_TRUE(user_manager->IsCurrentUserNew()); 318 EXPECT_TRUE(user_manager->IsCurrentUserNew());
304 } 319 }
305 320
306 const BlockingLoginTestParam kBlockinLoginTestCases[] = { 321 const BlockingLoginTestParam kBlockinLoginTestCases[] = {
307 {0, kUsername, true, false}, 322 { 0, kUsername, true },
308 {1, kUsername, true, false}, 323 { 1, kUsername, true },
309 {2, kUsername, true, false}, 324 { 2, kUsername, true },
310 {3, kUsername, true, false}, 325 { 3, kUsername, true },
311 {4, kUsername, true, false}, 326 { 4, kUsername, true },
312 {5, kUsername, true, false}, 327 { 5, kUsername, true },
313 {0, kUsername, false, false}, 328 { 0, kUsername, false },
314 {1, kUsername, false, false}, 329 { 1, kUsername, false },
315 {2, kUsername, false, false}, 330 { 2, kUsername, false },
316 {3, kUsername, false, false}, 331 { 3, kUsername, false },
317 {4, kUsername, false, false}, 332 { 4, kUsername, false },
318 {5, kUsername, false, false}, 333 { 5, kUsername, false },
319 {0, kUsernameOtherDomain, true, false}, 334 { 0, kUsernameOtherDomain, true },
320 {1, kUsernameOtherDomain, true, false}, 335 { 1, kUsernameOtherDomain, true },
321 {2, kUsernameOtherDomain, true, false}, 336 { 2, kUsernameOtherDomain, true },
322 {3, kUsernameOtherDomain, true, false}, 337 { 3, kUsernameOtherDomain, true },
323 {4, kUsernameOtherDomain, true, false}, 338 { 4, kUsernameOtherDomain, true },
324 {5, kUsernameOtherDomain, true, false}, 339 { 5, kUsernameOtherDomain, true },
325
326 {0, kUsername, true, true},
327 {1, kUsername, true, true},
328 {2, kUsername, true, true},
329 {3, kUsername, true, true},
330 {4, kUsername, true, true},
331 {5, kUsername, true, true},
332 {0, kUsername, false, true},
333 {1, kUsername, false, true},
334 {2, kUsername, false, true},
335 {3, kUsername, false, true},
336 {4, kUsername, false, true},
337 {5, kUsername, false, true},
338 {0, kUsernameOtherDomain, true, true},
339 {1, kUsernameOtherDomain, true, true},
340 {2, kUsernameOtherDomain, true, true},
341 {3, kUsernameOtherDomain, true, true},
342 {4, kUsernameOtherDomain, true, true},
343 {5, kUsernameOtherDomain, true, true},
344 }; 340 };
345 341
346 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance, 342 INSTANTIATE_TEST_CASE_P(BlockingLoginTestInstance,
347 BlockingLoginTest, 343 BlockingLoginTest,
348 testing::ValuesIn(kBlockinLoginTestCases)); 344 testing::ValuesIn(kBlockinLoginTestCases));
349 345
350 } // namespace chromeos 346 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698