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

Side by Side Diff: chrome/browser/chromeos/drive/drive_notification_manager_factory_browsertest.cc

Issue 378513005: [Athena] Extract Chrome OS authentication stack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 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 "chrome/browser/drive/drive_notification_manager_factory.h" 5 #include "chrome/browser/drive/drive_notification_manager_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "chrome/browser/chromeos/login/users/user_manager.h"
Nikita (slow) 2014/07/07 21:05:40 Still needed for chromeos::UserManager::Get()
Denis Kuznetsov (DE-MUC) 2014/07/08 11:08:28 Done.
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" 9 #include "chrome/browser/chromeos/profiles/profile_helper.h"
11 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chromeos/chromeos_switches.h" 13 #include "chromeos/chromeos_switches.h"
14 #include "chromeos/login/user_names.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace drive { 17 namespace drive {
18 18
19 class DriveNotificationManagerFactoryLoginScreenBrowserTest 19 class DriveNotificationManagerFactoryLoginScreenBrowserTest
20 : public InProcessBrowserTest { 20 : public InProcessBrowserTest {
21 protected: 21 protected:
22 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 22 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
23 command_line->AppendSwitch(chromeos::switches::kLoginManager); 23 command_line->AppendSwitch(chromeos::switches::kLoginManager);
24 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 24 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
(...skipping 11 matching lines...) Expand all
36 } 36 }
37 37
38 class DriveNotificationManagerFactoryGuestBrowserTest 38 class DriveNotificationManagerFactoryGuestBrowserTest
39 : public InProcessBrowserTest { 39 : public InProcessBrowserTest {
40 protected: 40 protected:
41 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 41 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
42 command_line->AppendSwitch(chromeos::switches::kGuestSession); 42 command_line->AppendSwitch(chromeos::switches::kGuestSession);
43 command_line->AppendSwitch(::switches::kIncognito); 43 command_line->AppendSwitch(::switches::kIncognito);
44 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); 44 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user");
45 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, 45 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser,
46 chromeos::UserManager::kGuestUserName); 46 chromeos::login::kGuestUserName);
47 } 47 }
48 }; 48 };
49 49
50 // Verify that no DriveNotificationManager is instantiated for the sign-in 50 // Verify that no DriveNotificationManager is instantiated for the sign-in
51 // profile or the guest profile while a guest session is in progress. 51 // profile or the guest profile while a guest session is in progress.
52 IN_PROC_BROWSER_TEST_F(DriveNotificationManagerFactoryGuestBrowserTest, 52 IN_PROC_BROWSER_TEST_F(DriveNotificationManagerFactoryGuestBrowserTest,
53 NoDriveNotificationManager) { 53 NoDriveNotificationManager) {
54 chromeos::UserManager* user_manager = chromeos::UserManager::Get(); 54 chromeos::UserManager* user_manager = chromeos::UserManager::Get();
55 EXPECT_TRUE(user_manager->IsLoggedInAsGuest()); 55 EXPECT_TRUE(user_manager->IsLoggedInAsGuest());
56 Profile* guest_profile = chromeos::ProfileHelper::Get() 56 Profile* guest_profile = chromeos::ProfileHelper::Get()
57 ->GetProfileByUser(user_manager->GetActiveUser()) 57 ->GetProfileByUser(user_manager->GetActiveUser())
58 ->GetOriginalProfile(); 58 ->GetOriginalProfile();
59 Profile* signin_profile = 59 Profile* signin_profile =
60 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile(); 60 chromeos::ProfileHelper::GetSigninProfile()->GetOriginalProfile();
61 EXPECT_FALSE(DriveNotificationManagerFactory::FindForBrowserContext( 61 EXPECT_FALSE(DriveNotificationManagerFactory::FindForBrowserContext(
62 guest_profile)); 62 guest_profile));
63 EXPECT_FALSE(DriveNotificationManagerFactory::FindForBrowserContext( 63 EXPECT_FALSE(DriveNotificationManagerFactory::FindForBrowserContext(
64 signin_profile)); 64 signin_profile));
65 } 65 }
66 66
67 } // namespace drive 67 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698