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

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" 27 #include "chrome/browser/chromeos/login/wizard_controller.h"
bartfab (slow) 2013/05/27 17:29:52 Nit: No longer used.
Nikita (slow) 2013/05/27 17:51:21 Done.
26 #include "chrome/browser/chromeos/policy/device_local_account.h" 28 #include "chrome/browser/chromeos/policy/device_local_account.h"
27 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 29 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 30 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
29 #include "chrome/browser/lifetime/application_lifetime.h" 31 #include "chrome/browser/lifetime/application_lifetime.h"
30 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" 32 #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
31 #include "chrome/browser/policy/cloud/policy_builder.h" 33 #include "chrome/browser/policy/cloud/policy_builder.h"
32 #include "chrome/browser/policy/policy_service.h" 34 #include "chrome/browser/policy/policy_service.h"
33 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h" 35 #include "chrome/browser/policy/proto/chromeos/chrome_device_policy.pb.h"
34 #include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h" 36 #include "chrome/browser/policy/proto/chromeos/install_attributes.pb.h"
35 #include "chrome/browser/policy/test/local_policy_test_server.h" 37 #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); 136 PolicyBuilder::kFakeDeviceId);
135 ASSERT_TRUE(test_server_.Start()); 137 ASSERT_TRUE(test_server_.Start());
136 138
137 InProcessBrowserTest::SetUp(); 139 InProcessBrowserTest::SetUp();
138 } 140 }
139 141
140 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 142 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
141 command_line->AppendSwitch(chromeos::switches::kLoginManager); 143 command_line->AppendSwitch(chromeos::switches::kLoginManager);
142 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); 144 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests);
143 command_line->AppendSwitchASCII( 145 command_line->AppendSwitchASCII(
144 chromeos::switches::kLoginScreen,
145 chromeos::WizardController::kLoginScreenName);
146 command_line->AppendSwitchASCII(
147 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec()); 146 switches::kDeviceManagementUrl, test_server_.GetServiceURL().spec());
148 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 147 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
149 } 148 }
150 149
151 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 150 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
152 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 151 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
153 152
154 // Clear command-line arguments (but keep command-line switches) so the 153 // Clear command-line arguments (but keep command-line switches) so the
155 // startup pages policy takes effect. 154 // startup pages policy takes effect.
156 CommandLine* command_line = CommandLine::ForCurrentProcess(); 155 CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 366 }
368 367
369 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) { 368 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, StartSession) {
370 // This observes the display name becoming available as this indicates 369 // This observes the display name becoming available as this indicates
371 // device-local account policy is fully loaded, which is a prerequisite for 370 // device-local account policy is fully loaded, which is a prerequisite for
372 // successful login. 371 // successful login.
373 NotificationWatcher( 372 NotificationWatcher(
374 chrome::NOTIFICATION_USER_LIST_CHANGED, 373 chrome::NOTIFICATION_USER_LIST_CHANGED,
375 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName1)).Run(); 374 base::Bind(&DisplayNameMatches, user_id_1_, kDisplayName1)).Run();
376 375
376 chromeos::LoginDisplayHost* host =
377 chromeos::LoginDisplayHostImpl::default_host();
378 ASSERT_TRUE(host);
379 host->StartSignInScreen();
Denis Kuznetsov (DE-MUC) 2013/05/27 16:46:08 Why do we need this change in this CL?
Nikita (slow) 2013/05/27 16:49:57 I'm removing --login-screen=login switch so tests
377 chromeos::ExistingUserController* controller = 380 chromeos::ExistingUserController* controller =
378 chromeos::ExistingUserController::current_controller(); 381 chromeos::ExistingUserController::current_controller();
379 ASSERT_TRUE(controller); 382 ASSERT_TRUE(controller);
380 controller->LoginAsPublicAccount(user_id_1_); 383 controller->LoginAsPublicAccount(user_id_1_);
381 384
382 // Wait for the session to start. 385 // Wait for the session to start.
383 NotificationWatcher(chrome::NOTIFICATION_SESSION_STARTED, 386 NotificationWatcher(chrome::NOTIFICATION_SESSION_STARTED,
384 base::Bind(IsSessionStarted)).Run(); 387 base::Bind(IsSessionStarted)).Run();
385 388
386 // Check that the startup pages specified in policy were opened. 389 // Check that the startup pages specified in policy were opened.
387 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); 390 EXPECT_EQ(1U, chrome::GetTotalBrowserCount());
388 Browser* browser = 391 Browser* browser =
389 chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH); 392 chrome::FindLastActiveWithHostDesktopType(chrome::HOST_DESKTOP_TYPE_ASH);
390 ASSERT_TRUE(browser); 393 ASSERT_TRUE(browser);
391 394
392 TabStripModel* tabs = browser->tab_strip_model(); 395 TabStripModel* tabs = browser->tab_strip_model();
393 ASSERT_TRUE(tabs); 396 ASSERT_TRUE(tabs);
394 int expected_tab_count = static_cast<int>(arraysize(kStartupURLs)); 397 int expected_tab_count = static_cast<int>(arraysize(kStartupURLs));
395 EXPECT_EQ(expected_tab_count, tabs->count()); 398 EXPECT_EQ(expected_tab_count, tabs->count());
396 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i) 399 for (int i = 0; i < expected_tab_count && i < tabs->count(); ++i)
397 EXPECT_EQ(GURL(kStartupURLs[i]), tabs->GetWebContentsAt(i)->GetURL()); 400 EXPECT_EQ(GURL(kStartupURLs[i]), tabs->GetWebContentsAt(i)->GetURL());
398 } 401 }
399 402
400 } // namespace policy 403 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698