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

Side by Side Diff: chrome/browser/chromeos/login/login_browsertest.cc

Issue 10590004: [cros] Fake a stub user login when no --login-manager and --login-user are given. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 5 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) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" 7 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h"
8 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" 8 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h"
9 #include "chrome/browser/chromeos/cros/mock_network_library.h" 9 #include "chrome/browser/chromeos/cros/mock_network_library.h"
10 #include "chrome/browser/profiles/profile_manager.h" 10 #include "chrome/browser/profiles/profile_manager.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LoginTestBase::SetUpInProcessBrowserTestFixture(); 56 LoginTestBase::SetUpInProcessBrowserTestFixture();
57 } 57 }
58 58
59 virtual void SetUpCommandLine(CommandLine* command_line) { 59 virtual void SetUpCommandLine(CommandLine* command_line) {
60 command_line->AppendSwitchASCII(switches::kLoginUser, "TestUser@gmail.com"); 60 command_line->AppendSwitchASCII(switches::kLoginUser, "TestUser@gmail.com");
61 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 61 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
62 command_line->AppendSwitch(switches::kNoFirstRun); 62 command_line->AppendSwitch(switches::kNoFirstRun);
63 } 63 }
64 }; 64 };
65 65
66 class LoginProfileTest : public LoginUserTest { 66 class LoginGuestTest : public LoginTestBase {
67 protected: 67 protected:
68 virtual void SetUpCommandLine(CommandLine* command_line) { 68 virtual void SetUpCommandLine(CommandLine* command_line) {
69 command_line->AppendSwitch(switches::kGuestSession);
70 command_line->AppendSwitch(switches::kIncognito);
69 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); 71 command_line->AppendSwitchASCII(switches::kLoginProfile, "user");
70 command_line->AppendSwitch(switches::kNoFirstRun); 72 command_line->AppendSwitch(switches::kNoFirstRun);
71 } 73 }
72 }; 74 };
73 75
74 // After a chrome crash, the session manager will restart chrome with 76 // After a chrome crash, the session manager will restart chrome with
75 // the -login-user flag indicating that the user is already logged in. 77 // the -login-user flag indicating that the user is already logged in.
76 // This profile should NOT be an OTR profile. 78 // This profile should NOT be an OTR profile.
77 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { 79 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) {
78 Profile* profile = browser()->profile(); 80 Profile* profile = browser()->profile();
79 EXPECT_EQ("user", profile->GetPath().BaseName().value()); 81 EXPECT_EQ("user", profile->GetPath().BaseName().value());
80 EXPECT_FALSE(profile->IsOffTheRecord()); 82 EXPECT_FALSE(profile->IsOffTheRecord());
81 } 83 }
82 84
83 // On initial launch, we should get the OTR default profile. 85 // After a guest login, we should get the OTR default profile.
84 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { 86 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) {
85 Profile* profile = browser()->profile(); 87 Profile* profile = browser()->profile();
86 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); 88 EXPECT_EQ("Default", profile->GetPath().BaseName().value());
87 EXPECT_TRUE(profile->IsOffTheRecord()); 89 EXPECT_TRUE(profile->IsOffTheRecord());
88 // Ensure there's extension service for this profile. 90 // Ensure there's extension service for this profile.
89 EXPECT_TRUE(profile->GetExtensionService()); 91 EXPECT_TRUE(profile->GetExtensionService());
90 } 92 }
91 93
92 } // namespace chromeos 94 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698