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/command_line.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/prefs/pref_service_syncable.h" | 14 #include "chrome/browser/prefs/pref_service_syncable.h" |
14 #include "chrome/browser/profiles/avatar_menu_observer.h" | 15 #include "chrome/browser/profiles/avatar_menu_observer.h" |
15 #include "chrome/browser/profiles/profile_info_cache.h" | 16 #include "chrome/browser/profiles/profile_info_cache.h" |
16 #include "chrome/browser/profiles/profiles_state.h" | 17 #include "chrome/browser/profiles/profiles_state.h" |
17 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
18 #include "chrome/test/base/testing_profile_manager.h" | 19 #include "chrome/test/base/testing_profile_manager.h" |
| 20 #include "components/signin/core/common/signin_switches.h" |
19 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
22 | 24 |
23 using base::ASCIIToUTF16; | 25 using base::ASCIIToUTF16; |
24 | 26 |
25 namespace { | 27 namespace { |
26 | 28 |
27 class MockObserver : public AvatarMenuObserver { | 29 class MockObserver : public AvatarMenuObserver { |
28 public: | 30 public: |
(...skipping 13 matching lines...) Expand all Loading... |
42 DISALLOW_COPY_AND_ASSIGN(MockObserver); | 44 DISALLOW_COPY_AND_ASSIGN(MockObserver); |
43 }; | 45 }; |
44 | 46 |
45 class ProfileListDesktopTest : public testing::Test { | 47 class ProfileListDesktopTest : public testing::Test { |
46 public: | 48 public: |
47 ProfileListDesktopTest() | 49 ProfileListDesktopTest() |
48 : manager_(TestingBrowserProcess::GetGlobal()) { | 50 : manager_(TestingBrowserProcess::GetGlobal()) { |
49 } | 51 } |
50 | 52 |
51 virtual void SetUp() { | 53 virtual void SetUp() { |
| 54 CommandLine::ForCurrentProcess()-> |
| 55 AppendSwitch(switches::kDisableNewAvatarMenu); |
52 ASSERT_TRUE(manager_.SetUp()); | 56 ASSERT_TRUE(manager_.SetUp()); |
53 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
54 // AvatarMenu and multiple profiles works after user logged in. | 58 // AvatarMenu and multiple profiles works after user logged in. |
55 manager_.SetLoggedIn(true); | 59 manager_.SetLoggedIn(true); |
56 #endif | 60 #endif |
57 } | 61 } |
58 | 62 |
59 AvatarMenu* GetAvatarMenu() { | 63 AvatarMenu* GetAvatarMenu() { |
60 // Reset the MockObserver. | 64 // Reset the MockObserver. |
61 mock_observer_.reset(new MockObserver()); | 65 mock_observer_.reset(new MockObserver()); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 base::string16 supervised_user_label = | 341 base::string16 supervised_user_label = |
338 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); | 342 l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_AVATAR_LABEL); |
339 const AvatarMenu::Item& item1 = model->GetItemAt(0); | 343 const AvatarMenu::Item& item1 = model->GetItemAt(0); |
340 EXPECT_NE(item1.sync_state, supervised_user_label); | 344 EXPECT_NE(item1.sync_state, supervised_user_label); |
341 | 345 |
342 const AvatarMenu::Item& item2 = model->GetItemAt(1); | 346 const AvatarMenu::Item& item2 = model->GetItemAt(1); |
343 EXPECT_EQ(item2.sync_state, supervised_user_label); | 347 EXPECT_EQ(item2.sync_state, supervised_user_label); |
344 } | 348 } |
345 | 349 |
346 } // namespace | 350 } // namespace |
OLD | NEW |