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 #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_interface.h" | 10 #include "chrome/browser/profiles/profile_info_interface.h" |
11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/test/testing_browser_process_test.h" |
12 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
13 #include "grit/theme_resources.h" | 14 #include "grit/theme_resources.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 class FakeProfileInfo : public ProfileInfoInterface { | 20 class FakeProfileInfo : public ProfileInfoInterface { |
20 public: | 21 public: |
21 FakeProfileInfo() {} | 22 FakeProfileInfo() {} |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 virtual void OnAvatarMenuModelChanged() { | 60 virtual void OnAvatarMenuModelChanged() { |
60 ++count_; | 61 ++count_; |
61 } | 62 } |
62 | 63 |
63 int change_count() { return count_; } | 64 int change_count() { return count_; } |
64 | 65 |
65 private: | 66 private: |
66 int count_; | 67 int count_; |
67 }; | 68 }; |
68 | 69 |
69 class AvatarMenuModelTest : public testing::Test { | 70 class AvatarMenuModelTest : public TestingBrowserProcessTest { |
70 public: | 71 public: |
71 FakeProfileInfo* cache() { | 72 FakeProfileInfo* cache() { |
72 return &cache_; | 73 return &cache_; |
73 } | 74 } |
74 | 75 |
75 Browser* browser() { | 76 Browser* browser() { |
76 return NULL; | 77 return NULL; |
77 } | 78 } |
78 | 79 |
79 const gfx::Image& GetTestImage() { | 80 const gfx::Image& GetTestImage() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); | 151 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); |
151 EXPECT_EQ(1U, item2.model_index); | 152 EXPECT_EQ(1U, item2.model_index); |
152 EXPECT_EQ(ASCIIToUTF16("Test 3"), item2.name); | 153 EXPECT_EQ(ASCIIToUTF16("Test 3"), item2.name); |
153 | 154 |
154 const AvatarMenuModel::Item& item3 = model.GetItemAt(2); | 155 const AvatarMenuModel::Item& item3 = model.GetItemAt(2); |
155 EXPECT_EQ(2U, item3.model_index); | 156 EXPECT_EQ(2U, item3.model_index); |
156 EXPECT_EQ(ASCIIToUTF16("Test 2"), item3.name); | 157 EXPECT_EQ(ASCIIToUTF16("Test 2"), item3.name); |
157 } | 158 } |
158 | 159 |
159 } // namespace | 160 } // namespace |
OLD | NEW |