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/profiles/avatar_menu_model_unittest.cc

Issue 8230011: [Mac/multiprofile] "Customize User..." should edit the currently active profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments Created 9 years, 2 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) 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 #include "chrome/browser/profiles/avatar_menu_model.h" 5 #include "chrome/browser/profiles/avatar_menu_model.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/profiles/avatar_menu_model_observer.h" 9 #include "chrome/browser/profiles/avatar_menu_model_observer.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 const AvatarMenuModel::Item& item1 = model.GetItemAt(0); 66 const AvatarMenuModel::Item& item1 = model.GetItemAt(0);
67 EXPECT_EQ(0U, item1.model_index); 67 EXPECT_EQ(0U, item1.model_index);
68 EXPECT_EQ(name1, item1.name); 68 EXPECT_EQ(name1, item1.name);
69 69
70 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); 70 const AvatarMenuModel::Item& item2 = model.GetItemAt(1);
71 EXPECT_EQ(1U, item2.model_index); 71 EXPECT_EQ(1U, item2.model_index);
72 EXPECT_EQ(name2, item2.name); 72 EXPECT_EQ(name2, item2.name);
73 } 73 }
74 74
75 TEST_F(AvatarMenuModelTest, ActiveItem) {
76 string16 name1(ASCIIToUTF16("Test 1"));
77 string16 name2(ASCIIToUTF16("Test 2"));
78
79 manager()->CreateTestingProfile("p1", name1, 0);
80 manager()->CreateTestingProfile("p2", name2, 0);
81
82 MockObserver observer;
83 AvatarMenuModel model(manager()->profile_info_cache(), &observer, browser());
84 ASSERT_EQ(2U, model.GetNumberOfItems());
85 // TODO(jeremy): Expand test to verify active profile index other than 0
86 // crbug.com/100871
87 ASSERT_EQ(0U, model.GetActiveProfileIndex());
88 }
89
75 TEST_F(AvatarMenuModelTest, ModifyingNameResortsCorrectly) { 90 TEST_F(AvatarMenuModelTest, ModifyingNameResortsCorrectly) {
76 string16 name1(ASCIIToUTF16("Alpha")); 91 string16 name1(ASCIIToUTF16("Alpha"));
77 string16 name2(ASCIIToUTF16("Beta")); 92 string16 name2(ASCIIToUTF16("Beta"));
78 string16 newname1(ASCIIToUTF16("Gamma")); 93 string16 newname1(ASCIIToUTF16("Gamma"));
79 94
80 manager()->CreateTestingProfile("p1", name1, 0); 95 manager()->CreateTestingProfile("p1", name1, 0);
81 manager()->CreateTestingProfile("p2", name2, 0); 96 manager()->CreateTestingProfile("p2", name2, 0);
82 97
83 MockObserver observer; 98 MockObserver observer;
84 AvatarMenuModel model(manager()->profile_info_cache(), &observer, browser()); 99 AvatarMenuModel model(manager()->profile_info_cache(), &observer, browser());
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); 152 const AvatarMenuModel::Item& item2 = model.GetItemAt(1);
138 EXPECT_EQ(1U, item2.model_index); 153 EXPECT_EQ(1U, item2.model_index);
139 EXPECT_EQ(name2, item2.name); 154 EXPECT_EQ(name2, item2.name);
140 155
141 const AvatarMenuModel::Item& item3 = model.GetItemAt(2); 156 const AvatarMenuModel::Item& item3 = model.GetItemAt(2);
142 EXPECT_EQ(2U, item3.model_index); 157 EXPECT_EQ(2U, item3.model_index);
143 EXPECT_EQ(name3, item3.name); 158 EXPECT_EQ(name3, item3.name);
144 } 159 }
145 160
146 } // namespace 161 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model.cc ('k') | chrome/browser/ui/cocoa/profile_menu_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698