OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/profile_list_desktop.h" | 5 #include "chrome/browser/profiles/profile_list_desktop.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/prefs/pref_service_syncable.h" | 13 #include "chrome/browser/prefs/pref_service_syncable.h" |
14 #include "chrome/browser/profiles/avatar_menu_observer.h" | 14 #include "chrome/browser/profiles/avatar_menu_observer.h" |
15 #include "chrome/browser/profiles/profile_info_cache.h" | 15 #include "chrome/browser/profiles/profile_info_cache.h" |
16 #include "chrome/browser/profiles/profiles_state.h" | 16 #include "chrome/browser/profiles/profiles_state.h" |
17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
18 #include "chrome/test/base/testing_profile_manager.h" | 18 #include "chrome/test/base/testing_profile_manager.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
22 | 23 |
23 using base::ASCIIToUTF16; | 24 using base::ASCIIToUTF16; |
24 | 25 |
25 namespace { | 26 namespace { |
26 | 27 |
27 class MockObserver : public AvatarMenuObserver { | 28 class MockObserver : public AvatarMenuObserver { |
28 public: | 29 public: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 cache->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), | 80 cache->GetUserDataDir().AppendASCII(name), ASCIIToUTF16(name), |
80 base::string16(), 0, "TEST_ID"); | 81 base::string16(), 0, "TEST_ID"); |
81 } | 82 } |
82 | 83 |
83 int change_count() const { return mock_observer_->change_count(); } | 84 int change_count() const { return mock_observer_->change_count(); } |
84 | 85 |
85 private: | 86 private: |
86 TestingProfileManager manager_; | 87 TestingProfileManager manager_; |
87 scoped_ptr<MockObserver> mock_observer_; | 88 scoped_ptr<MockObserver> mock_observer_; |
88 scoped_ptr<AvatarMenu> avatar_menu_; | 89 scoped_ptr<AvatarMenu> avatar_menu_; |
| 90 content::TestBrowserThreadBundle thread_bundle_; |
89 | 91 |
90 DISALLOW_COPY_AND_ASSIGN(ProfileListDesktopTest); | 92 DISALLOW_COPY_AND_ASSIGN(ProfileListDesktopTest); |
91 }; | 93 }; |
92 | 94 |
93 TEST_F(ProfileListDesktopTest, InitialCreation) { | 95 TEST_F(ProfileListDesktopTest, InitialCreation) { |
94 manager()->CreateTestingProfile("Test 1"); | 96 manager()->CreateTestingProfile("Test 1"); |
95 manager()->CreateTestingProfile("Test 2"); | 97 manager()->CreateTestingProfile("Test 2"); |
96 | 98 |
97 AvatarMenu* model = GetAvatarMenu(); | 99 AvatarMenu* model = GetAvatarMenu(); |
98 EXPECT_EQ(0, change_count()); | 100 EXPECT_EQ(0, change_count()); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 base::string16 supervised_user_label = | 339 base::string16 supervised_user_label = |
338 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); | 340 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); |
339 const AvatarMenu::Item& item1 = model->GetItemAt(0); | 341 const AvatarMenu::Item& item1 = model->GetItemAt(0); |
340 EXPECT_NE(item1.sync_state, supervised_user_label); | 342 EXPECT_NE(item1.sync_state, supervised_user_label); |
341 | 343 |
342 const AvatarMenu::Item& item2 = model->GetItemAt(1); | 344 const AvatarMenu::Item& item2 = model->GetItemAt(1); |
343 EXPECT_EQ(item2.sync_state, supervised_user_label); | 345 EXPECT_EQ(item2.sync_state, supervised_user_label); |
344 } | 346 } |
345 | 347 |
346 } // namespace | 348 } // namespace |
OLD | NEW |