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

Side by Side Diff: chrome/browser/ui/cocoa/browser/avatar_button_controller_unittest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol 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) 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 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h" 5 #import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h"
6 6
7 #include "base/memory/scoped_nsobject.h" 7 #include "base/mac/scoped_nsobject.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" 10 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h"
11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
12 #include "chrome/browser/ui/cocoa/info_bubble_window.h" 12 #include "chrome/browser/ui/cocoa/info_bubble_window.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 14
15 class AvatarButtonControllerTest : public CocoaProfileTest { 15 class AvatarButtonControllerTest : public CocoaProfileTest {
16 public: 16 public:
17 virtual void SetUp() { 17 virtual void SetUp() {
(...skipping 10 matching lines...) Expand all
28 CocoaProfileTest::TearDown(); 28 CocoaProfileTest::TearDown();
29 } 29 }
30 30
31 NSButton* button() { return [controller_ buttonView]; } 31 NSButton* button() { return [controller_ buttonView]; }
32 32
33 NSView* view() { return [controller_ view]; } 33 NSView* view() { return [controller_ view]; }
34 34
35 AvatarButtonController* controller() { return controller_.get(); } 35 AvatarButtonController* controller() { return controller_.get(); }
36 36
37 private: 37 private:
38 scoped_nsobject<AvatarButtonController> controller_; 38 base::scoped_nsobject<AvatarButtonController> controller_;
39 }; 39 };
40 40
41 TEST_F(AvatarButtonControllerTest, AddRemoveProfiles) { 41 TEST_F(AvatarButtonControllerTest, AddRemoveProfiles) {
42 EXPECT_TRUE([view() isHidden]); 42 EXPECT_TRUE([view() isHidden]);
43 43
44 testing_profile_manager()->CreateTestingProfile("one"); 44 testing_profile_manager()->CreateTestingProfile("one");
45 45
46 EXPECT_FALSE([view() isHidden]); 46 EXPECT_FALSE([view() isHidden]);
47 47
48 testing_profile_manager()->CreateTestingProfile("two"); 48 testing_profile_manager()->CreateTestingProfile("two");
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Create a second profile to enable the avatar menu. 82 // Create a second profile to enable the avatar menu.
83 testing_profile_manager()->CreateTestingProfile("p2"); 83 testing_profile_manager()->CreateTestingProfile("p2");
84 84
85 EXPECT_FALSE([controller() labelButtonView]); 85 EXPECT_FALSE([controller() labelButtonView]);
86 86
87 // Transform the first profile to a managed user profile. 87 // Transform the first profile to a managed user profile.
88 profile()->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true); 88 profile()->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true);
89 89
90 // Build a new controller to check if it is initialized correctly for a 90 // Build a new controller to check if it is initialized correctly for a
91 // managed user profile. 91 // managed user profile.
92 scoped_nsobject<AvatarButtonController> controller( 92 base::scoped_nsobject<AvatarButtonController> controller(
93 [[AvatarButtonController alloc] initWithBrowser:browser()]); 93 [[AvatarButtonController alloc] initWithBrowser:browser()]);
94 94
95 EXPECT_TRUE([controller labelButtonView]); 95 EXPECT_TRUE([controller labelButtonView]);
96 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698