| OLD | NEW |
| 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/avatar_icon_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" | 10 #include "chrome/browser/autocomplete/autocomplete_classifier_factory.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 AvatarBaseController* icon_controller() { | 45 AvatarBaseController* icon_controller() { |
| 46 BrowserWindowCocoa* window = | 46 BrowserWindowCocoa* window = |
| 47 static_cast<BrowserWindowCocoa*>(browser()->window()); | 47 static_cast<BrowserWindowCocoa*>(browser()->window()); |
| 48 return [window->cocoa_controller() avatarButtonController]; | 48 return [window->cocoa_controller() avatarButtonController]; |
| 49 } | 49 } |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 TEST_F(AvatarIconControllerTest, ShowingAvatarIconInIncognito) { | 52 TEST_F(AvatarIconControllerTest, ShowingAvatarIconInIncognito) { |
| 53 Browser* browser = | 53 Browser* browser = |
| 54 new Browser(Browser::CreateParams(profile()->GetOffTheRecordProfile(), | 54 new Browser(Browser::CreateParams(profile()->GetOffTheRecordProfile())); |
| 55 chrome::GetActiveDesktop())); | |
| 56 BrowserWindowCocoa* window = | 55 BrowserWindowCocoa* window = |
| 57 static_cast<BrowserWindowCocoa*>(browser->window()); | 56 static_cast<BrowserWindowCocoa*>(browser->window()); |
| 58 AvatarBaseController* icon_controller = | 57 AvatarBaseController* icon_controller = |
| 59 [window->cocoa_controller() avatarButtonController]; | 58 [window->cocoa_controller() avatarButtonController]; |
| 60 // In incognito, we should be using the AvatarIconController to show the | 59 // In incognito, we should be using the AvatarIconController to show the |
| 61 // incognito guy. | 60 // incognito guy. |
| 62 EXPECT_TRUE([icon_controller isKindOfClass:[AvatarIconController class]]); | 61 EXPECT_TRUE([icon_controller isKindOfClass:[AvatarIconController class]]); |
| 63 | 62 |
| 64 browser->window()->Close(); | 63 browser->window()->Close(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 TEST_F(AvatarIconControllerTest, ShowingAvatarButtonInRegularSession) { | 66 TEST_F(AvatarIconControllerTest, ShowingAvatarButtonInRegularSession) { |
| 68 // In a regular session, we should be using the AvatarButtonController to show | 67 // In a regular session, we should be using the AvatarButtonController to show |
| 69 // the profile name. | 68 // the profile name. |
| 70 EXPECT_TRUE([icon_controller() isKindOfClass:[AvatarButtonController class]]); | 69 EXPECT_TRUE([icon_controller() isKindOfClass:[AvatarButtonController class]]); |
| 71 } | 70 } |
| OLD | NEW |