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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm

Issue 633233002: Lock only permitted where a supervised user is or was. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alexei's comments Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/profiles/profile_window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #import "base/mac/foundation_util.h" 8 #import "base/mac/foundation_util.h"
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 492
493 TEST_F(ProfileChooserControllerTest, SignedInProfileLockEnabled) { 493 TEST_F(ProfileChooserControllerTest, SignedInProfileLockEnabled) {
494 switches::EnableNewProfileManagementForTesting( 494 switches::EnableNewProfileManagementForTesting(
495 CommandLine::ForCurrentProcess()); 495 CommandLine::ForCurrentProcess());
496 // Sign in the first profile. 496 // Sign in the first profile.
497 ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache(); 497 ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache();
498 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail)); 498 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail));
499 // The preference, not the email, determines whether the profile can lock. 499 // The preference, not the email, determines whether the profile can lock.
500 browser()->profile()->GetPrefs()->SetString( 500 browser()->profile()->GetPrefs()->SetString(
501 prefs::kGoogleServicesHostedDomain, "google.com"); 501 prefs::kGoogleServicesHostedDomain, "google.com");
502 // Lock is only available where a supervised user is present.
503 cache->SetSupervisedUserIdOfProfileAtIndex(1, kEmail);
502 504
503 StartProfileChooserController(); 505 StartProfileChooserController();
504 NSArray* subviews = [[[controller() window] contentView] subviews]; 506 NSArray* subviews = [[[controller() window] contentView] subviews];
505 ASSERT_EQ(2U, [subviews count]); 507 ASSERT_EQ(2U, [subviews count]);
506 subviews = [[subviews objectAtIndex:0] subviews]; 508 subviews = [[subviews objectAtIndex:0] subviews];
507 509
508 // There will be three buttons and two separators in the option buttons view. 510 // There will be three buttons and two separators in the option buttons view.
509 NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews]; 511 NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews];
510 ASSERT_EQ(5U, [buttonSubviews count]); 512 ASSERT_EQ(5U, [buttonSubviews count]);
511 513
512 // There should be a lock button. 514 // There should be a lock button.
513 NSButton* lockButton = 515 NSButton* lockButton =
514 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); 516 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
515 ASSERT_TRUE(lockButton); 517 ASSERT_TRUE(lockButton);
516 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); 518 EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
517 EXPECT_EQ(controller(), [lockButton target]); 519 EXPECT_EQ(controller(), [lockButton target]);
518 EXPECT_TRUE([lockButton isEnabled]); 520 EXPECT_TRUE([lockButton isEnabled]);
519 } 521 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698