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

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

Issue 16105005: Cleanup legacy flags and switches (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/stl_util.h" 18 #include "base/stl_util.h"
19 #include "base/string_util.h" 19 #include "base/string_util.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/browser_process.h" 21 #include "chrome/browser/browser_process.h"
22 #include "chrome/browser/chromeos/login/existing_user_controller.h" 22 #include "chrome/browser/chromeos/login/existing_user_controller.h"
23 #include "chrome/browser/chromeos/login/login_display_host.h"
24 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
23 #include "chrome/browser/chromeos/login/user.h" 25 #include "chrome/browser/chromeos/login/user.h"
24 #include "chrome/browser/chromeos/login/user_manager.h" 26 #include "chrome/browser/chromeos/login/user_manager.h"
25 #include "chrome/browser/chromeos/login/wizard_controller.h"
26 #include "chrome/browser/chromeos/policy/device_local_account.h" 27 #include "chrome/browser/chromeos/policy/device_local_account.h"
27 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 28 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 29 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
29 #include "chrome/browser/lifetime/application_lifetime.h" 30 #include "chrome/browser/lifetime/application_lifetime.h"
30 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 31 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
31 #include "chrome/browser/policy/cloud/policy_builder.h" 32 #include "chrome/browser/policy/cloud/policy_builder.h"
32 #include "chrome/browser/policy/policy_service.h" 33 #include "chrome/browser/policy/policy_service.h"
33 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 34 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
34 #include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h" 35 #include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h"
35 #include "chrome/browser/policy/test/local_policy_test_server.h" 36 #include "chrome/browser/policy/test/local_policy_test_server.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 PolicyBuilder::kFakeDeviceId); 135 PolicyBuilder::kFakeDeviceId);
135 ASSERT_TRUE(test_server_.Start()); 136 ASSERT_TRUE(test_server_.Start());
136 137
137 InProcessBrowserTest::SetUp(); 138 InProcessBrowserTest::SetUp();
138 } 139 }
139 140
140 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 141 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
141 command_line->AppendSwitch(chromeos::switches::kLoginManager); 142 command_line->AppendSwitch(chromeos::switches::kLoginManager);
142 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); 143 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
143 command_line->AppendSwitchASCII( 144 command_line->AppendSwitchASCII(
144 chromeos::switches::kLoginScreen,
145 chromeos::WizardController::kLoginScreenName);
146 command_line->AppendSwitchASCII(
147 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec()); 145 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec());
148 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 146 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
149 } 147 }
150 148
151 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 149 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
152 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 150 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
153 151
154 // Clear command-line arguments (but keep command-line switches) so the 152 // Clear command-line arguments (but keep command-line switches) so the
155 // startup pages policy takes effect. 153 // startup pages policy takes effect.
156 CommandLine* command_line = CommandLine::ForCurrentProcess(); 154 CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 365 }
368 366
369 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) { 367 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) {
370 // This observes the display name becoming available as this indicates 368 // This observes the display name becoming available as this indicates
371 // device-local account policy is fully loaded, which is a prerequisite for 369 // device-local account policy is fully loaded, which is a prerequisite for
372 // successful login. 370 // successful login.
373 NotificationWatcher( 371 NotificationWatcher(
374 chrome::NOTIFICATION_USER_LIST_CHANGED, 372 chrome::NOTIFICATION_USER_LIST_CHANGED,
375 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName1)).Run(); 373 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName1)).Run();
376 374
375 chromeos::LoginDisplayHost* host =
376 chromeos::LoginDisplayHostImpl::default_host();
377 ASSERT_TRUE(host);
378 host->StartSignInScreen();
377 chromeos::ExistingUserController* controller = 379 chromeos::ExistingUserController* controller =
378 chromeos::ExistingUserController::current_controller(); 380 chromeos::ExistingUserController::current_controller();
379 ASSERT_TRUE(controller); 381 ASSERT_TRUE(controller);
380 controller->LoginAsPublicAccount(user_id_1_); 382 controller->LoginAsPublicAccount(user_id_1_);
381 383
382 // Wait for the session to start. 384 // Wait for the session to start.
383 NotificationWatcher(chrome::NOTIFICATION_SESSION_STARTED, 385 NotificationWatcher(chrome::NOTIFICATION_SESSION_STARTED,
384 base::Bind(IsSessionStarted)).Run(); 386 base::Bind(IsSessionStarted)).Run();
385 387
386 // Check that the startup pages specified in policy were opened. 388 // Check that the startup pages specified in policy were opened.
387 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 389 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
388 Browser* browser = 390 Browser* browser =
389 chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH); 391 chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH);
390 ASSERT_TRUE(browser); 392 ASSERT_TRUE(browser);
391 393
392 TabStripModel* tabs = browser->tab_strip_model(); 394 TabStripModel* tabs = browser->tab_strip_model();
393 ASSERT_TRUE(tabs); 395 ASSERT_TRUE(tabs);
394 int expected_tab_count = static_cast<int>(arraysize(kStartupURLs)); 396 int expected_tab_count = static_cast<int>(arraysize(kStartupURLs));
395 EXPECT_EQ(expected_tab_count, tabs->count()); 397 EXPECT_EQ(expected_tab_count, tabs->count());
396 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) 398 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i)
397 EXPECT_EQ(GURL(kStartupURLs[i]), tabs->GetWebContentsAt(i)->GetURL()); 399 EXPECT_EQ(GURL(kStartupURLs[i]), tabs->GetWebContentsAt(i)->GetURL());
398 } 400 }
399 401
400 } // namespace policy 402 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698