| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 AvatarBaseController* icon_controller() { | 44 AvatarBaseController* icon_controller() { |
| 45 BrowserWindowCocoa* window = | 45 BrowserWindowCocoa* window = |
| 46 static_cast<BrowserWindowCocoa*>(browser()->window()); | 46 static_cast<BrowserWindowCocoa*>(browser()->window()); |
| 47 return [window->cocoa_controller() avatarButtonController]; | 47 return [window->cocoa_controller() avatarButtonController]; |
| 48 } | 48 } |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 TEST_F(AvatarIconControllerTest, ShowingAvatarIconInIncognito) { | 51 TEST_F(AvatarIconControllerTest, ShowingAvatarIconInIncognito) { |
| 52 Browser* browser = | 52 Browser* browser = new Browser( |
| 53 new Browser(Browser::CreateParams(profile()->GetOffTheRecordProfile())); | 53 Browser::CreateParams(profile()->GetOffTheRecordProfile(), true)); |
| 54 BrowserWindowCocoa* window = | 54 BrowserWindowCocoa* window = |
| 55 static_cast<BrowserWindowCocoa*>(browser->window()); | 55 static_cast<BrowserWindowCocoa*>(browser->window()); |
| 56 AvatarBaseController* icon_controller = | 56 AvatarBaseController* icon_controller = |
| 57 [window->cocoa_controller() avatarButtonController]; | 57 [window->cocoa_controller() avatarButtonController]; |
| 58 // In incognito, we should be using the AvatarIconController to show the | 58 // In incognito, we should be using the AvatarIconController to show the |
| 59 // incognito icon. | 59 // incognito icon. |
| 60 EXPECT_TRUE([icon_controller isKindOfClass:[AvatarIconController class]]); | 60 EXPECT_TRUE([icon_controller isKindOfClass:[AvatarIconController class]]); |
| 61 | 61 |
| 62 browser->window()->Close(); | 62 browser->window()->Close(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 TEST_F(AvatarIconControllerTest, ShowingAvatarButtonInRegularSession) { | 65 TEST_F(AvatarIconControllerTest, ShowingAvatarButtonInRegularSession) { |
| 66 // In a regular session, we should be using the AvatarButtonController to show | 66 // In a regular session, we should be using the AvatarButtonController to show |
| 67 // the profile name. | 67 // the profile name. |
| 68 EXPECT_TRUE([icon_controller() isKindOfClass:[AvatarButtonController class]]); | 68 EXPECT_TRUE([icon_controller() isKindOfClass:[AvatarButtonController class]]); |
| 69 } | 69 } |
| OLD | NEW |