| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profile_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/profile_menu_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
| 8 #include "chrome/browser/profiles/avatar_menu_model.h" | 8 #include "chrome/browser/profiles/avatar_menu_model.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void TestBottomItems() { | 34 void TestBottomItems() { |
| 35 NSMenu* menu = [controller() menu]; | 35 NSMenu* menu = [controller() menu]; |
| 36 NSInteger count = [menu numberOfItems]; | 36 NSInteger count = [menu numberOfItems]; |
| 37 | 37 |
| 38 ASSERT_GE(count, 5); | 38 ASSERT_GE(count, 5); |
| 39 | 39 |
| 40 NSMenuItem* item = [menu itemAtIndex:count - 4]; | 40 NSMenuItem* item = [menu itemAtIndex:count - 4]; |
| 41 EXPECT_TRUE([item isSeparatorItem]); | 41 EXPECT_TRUE([item isSeparatorItem]); |
| 42 | 42 |
| 43 item = [menu itemAtIndex:count - 3]; | 43 item = [menu itemAtIndex:count - 3]; |
| 44 EXPECT_EQ(@selector(editProfile:), [item action]); | 44 EXPECT_EQ(@selector(editCurrentProfile:), [item action]); |
| 45 | 45 |
| 46 item = [menu itemAtIndex:count - 2]; | 46 item = [menu itemAtIndex:count - 2]; |
| 47 EXPECT_TRUE([item isSeparatorItem]); | 47 EXPECT_TRUE([item isSeparatorItem]); |
| 48 | 48 |
| 49 item = [menu itemAtIndex:count - 1]; | 49 item = [menu itemAtIndex:count - 1]; |
| 50 EXPECT_EQ(@selector(newProfile:), [item action]); | 50 EXPECT_EQ(@selector(newProfile:), [item action]); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void VerifyProfileNamedIsActive(NSString* title, int line) { | 53 void VerifyProfileNamedIsActive(NSString* title, int line) { |
| 54 for (NSMenuItem* item in [[controller() menu] itemArray]) { | 54 for (NSMenuItem* item in [[controller() menu] itemArray]) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 VerifyProfileNamedIsActive(@"Profile 2", __LINE__); | 140 VerifyProfileNamedIsActive(@"Profile 2", __LINE__); |
| 141 | 141 |
| 142 // Open a new browser and make sure it takes effect. | 142 // Open a new browser and make sure it takes effect. |
| 143 scoped_ptr<Browser> p3_browser(new Browser(Browser::TYPE_TABBED, profile3)); | 143 scoped_ptr<Browser> p3_browser(new Browser(Browser::TYPE_TABBED, profile3)); |
| 144 BrowserList::SetLastActive(p3_browser.get()); | 144 BrowserList::SetLastActive(p3_browser.get()); |
| 145 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); | 145 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); |
| 146 | 146 |
| 147 p3_browser.reset(); | 147 p3_browser.reset(); |
| 148 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); | 148 VerifyProfileNamedIsActive(@"Profile 3", __LINE__); |
| 149 } | 149 } |
| OLD | NEW |