| 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/fake_profile_info_interface.h" | 10 #include "chrome/browser/profiles/fake_profile_info_interface.h" |
| 11 #include "chrome/browser/profiles/profile_info_interface.h" | 11 #include "chrome/browser/profiles/profile_info_interface.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/test/base/testing_browser_process_test.h" | |
| 14 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| 19 class MockObserver : public AvatarMenuModelObserver { | 18 class MockObserver : public AvatarMenuModelObserver { |
| 20 public: | 19 public: |
| 21 MockObserver() : count_(0) {} | 20 MockObserver() : count_(0) {} |
| 22 virtual ~MockObserver() {} | 21 virtual ~MockObserver() {} |
| 23 | 22 |
| 24 virtual void OnAvatarMenuModelChanged( | 23 virtual void OnAvatarMenuModelChanged( |
| 25 AvatarMenuModel* avatar_menu_model) OVERRIDE{ | 24 AvatarMenuModel* avatar_menu_model) OVERRIDE{ |
| 26 ++count_; | 25 ++count_; |
| 27 } | 26 } |
| 28 | 27 |
| 29 int change_count() { return count_; } | 28 int change_count() { return count_; } |
| 30 | 29 |
| 31 private: | 30 private: |
| 32 int count_; | 31 int count_; |
| 33 }; | 32 }; |
| 34 | 33 |
| 35 class AvatarMenuModelTest : public TestingBrowserProcessTest { | 34 class AvatarMenuModelTest : public testing::Test { |
| 36 public: | 35 public: |
| 37 FakeProfileInfo* cache() { | 36 FakeProfileInfo* cache() { |
| 38 return &cache_; | 37 return &cache_; |
| 39 } | 38 } |
| 40 | 39 |
| 41 Browser* browser() { | 40 Browser* browser() { |
| 42 return NULL; | 41 return NULL; |
| 43 } | 42 } |
| 44 | 43 |
| 45 const gfx::Image& GetTestImage() { | 44 const gfx::Image& GetTestImage() { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); | 114 const AvatarMenuModel::Item& item2 = model.GetItemAt(1); |
| 116 EXPECT_EQ(1U, item2.model_index); | 115 EXPECT_EQ(1U, item2.model_index); |
| 117 EXPECT_EQ(ASCIIToUTF16("Test 3"), item2.name); | 116 EXPECT_EQ(ASCIIToUTF16("Test 3"), item2.name); |
| 118 | 117 |
| 119 const AvatarMenuModel::Item& item3 = model.GetItemAt(2); | 118 const AvatarMenuModel::Item& item3 = model.GetItemAt(2); |
| 120 EXPECT_EQ(2U, item3.model_index); | 119 EXPECT_EQ(2U, item3.model_index); |
| 121 EXPECT_EQ(ASCIIToUTF16("Test 2"), item3.name); | 120 EXPECT_EQ(ASCIIToUTF16("Test 2"), item3.name); |
| 122 } | 121 } |
| 123 | 122 |
| 124 } // namespace | 123 } // namespace |
| OLD | NEW |