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

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

Issue 308433002: Desktop Menu UMA for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename variables; subViews to access profileChooserController for UMA Created 6 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
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('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 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "chrome/browser/prefs/pref_service_syncable.h" 12 #include "chrome/browser/prefs/pref_service_syncable.h"
13 #include "chrome/browser/profiles/avatar_menu.h" 13 #include "chrome/browser/profiles/avatar_menu.h"
14 #include "chrome/browser/profiles/profile_info_cache.h" 14 #include "chrome/browser/profiles/profile_info_cache.h"
15 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 15 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
16 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 16 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/signin/signin_header_helper.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 19 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" 21 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "components/signin/core/browser/profile_oauth2_token_service.h" 23 #include "components/signin/core/browser/profile_oauth2_token_service.h"
23 #include "components/signin/core/browser/signin_manager.h" 24 #include "components/signin/core/browser/signin_manager.h"
24 25
25 const std::string kEmail = "user@gmail.com"; 26 const std::string kEmail = "user@gmail.com";
26 const std::string kSecondaryEmail = "user2@gmail.com"; 27 const std::string kSecondaryEmail = "user2@gmail.com";
27 const std::string kLoginToken = "oauth2_login_token"; 28 const std::string kLoginToken = "oauth2_login_token";
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 controller_.reset(); 62 controller_.reset();
62 CocoaProfileTest::TearDown(); 63 CocoaProfileTest::TearDown();
63 } 64 }
64 65
65 void StartProfileChooserController() { 66 void StartProfileChooserController() {
66 NSRect frame = [test_window() frame]; 67 NSRect frame = [test_window() frame];
67 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); 68 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame));
68 controller_.reset([[ProfileChooserController alloc] 69 controller_.reset([[ProfileChooserController alloc]
69 initWithBrowser:browser() 70 initWithBrowser:browser()
70 anchoredAt:point 71 anchoredAt:point
71 withMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER]); 72 withMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER
73 withServiceType:signin::GAIA_SERVICE_TYPE_NONE]);
72 [controller_ showWindow:nil]; 74 [controller_ showWindow:nil];
73 } 75 }
74 76
75 void EnableNewProfileManagement() { 77 void EnableNewProfileManagement() {
76 CommandLine::ForCurrentProcess()->AppendSwitch( 78 CommandLine::ForCurrentProcess()->AppendSwitch(
77 switches::kNewProfileManagement); 79 switches::kNewProfileManagement);
78 } 80 }
79 81
80 void EnableNewAvatarMenuOnly() { 82 void EnableNewAvatarMenuOnly() {
81 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kNewAvatarMenu); 83 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kNewAvatarMenu);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( 454 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16(
453 [static_cast<NSButton*>(activeProfileName) title])); 455 [static_cast<NSButton*>(activeProfileName) title]));
454 456
455 // Profile links. This is a local profile, so there should be a signin button. 457 // Profile links. This is a local profile, so there should be a signin button.
456 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; 458 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews];
457 EXPECT_EQ(1U, [linksSubviews count]); 459 EXPECT_EQ(1U, [linksSubviews count]);
458 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]); 460 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]);
459 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); 461 EXPECT_EQ(@selector(hideAccountManagement:), [link action]);
460 EXPECT_EQ(controller(), [link target]); 462 EXPECT_EQ(controller(), [link target]);
461 } 463 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698