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 <objbase.h> // For CoInitialize(). | 5 #include <objbase.h> // For CoInitialize(). |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class ProfileShortcutManagerTest : public testing::Test { | 34 class ProfileShortcutManagerTest : public testing::Test { |
35 protected: | 35 protected: |
36 ProfileShortcutManagerTest() | 36 ProfileShortcutManagerTest() |
37 : ui_thread_(BrowserThread::UI, &message_loop_), | 37 : ui_thread_(BrowserThread::UI, &message_loop_), |
38 file_thread_(BrowserThread::FILE, &message_loop_), | 38 file_thread_(BrowserThread::FILE, &message_loop_), |
39 profile_info_cache_(NULL), | 39 profile_info_cache_(NULL), |
40 fake_user_desktop_(base::DIR_USER_DESKTOP), | 40 fake_user_desktop_(base::DIR_USER_DESKTOP), |
41 fake_system_desktop_(base::DIR_COMMON_DESKTOP) { | 41 fake_system_desktop_(base::DIR_COMMON_DESKTOP) { |
42 } | 42 } |
43 | 43 |
44 virtual void SetUp() OVERRIDE { | 44 virtual void SetUp() override { |
45 CoInitialize(NULL); | 45 CoInitialize(NULL); |
46 | 46 |
47 TestingBrowserProcess* browser_process = | 47 TestingBrowserProcess* browser_process = |
48 TestingBrowserProcess::GetGlobal(); | 48 TestingBrowserProcess::GetGlobal(); |
49 profile_manager_.reset(new TestingProfileManager(browser_process)); | 49 profile_manager_.reset(new TestingProfileManager(browser_process)); |
50 ASSERT_TRUE(profile_manager_->SetUp()); | 50 ASSERT_TRUE(profile_manager_->SetUp()); |
51 profile_info_cache_ = profile_manager_->profile_info_cache(); | 51 profile_info_cache_ = profile_manager_->profile_info_cache(); |
52 profile_shortcut_manager_.reset( | 52 profile_shortcut_manager_.reset( |
53 ProfileShortcutManager::Create(profile_manager_->profile_manager())); | 53 ProfileShortcutManager::Create(profile_manager_->profile_manager())); |
54 profile_1_name_ = L"My profile"; | 54 profile_1_name_ = L"My profile"; |
55 profile_1_path_ = CreateProfileDirectory(profile_1_name_); | 55 profile_1_path_ = CreateProfileDirectory(profile_1_name_); |
56 profile_2_name_ = L"My profile 2"; | 56 profile_2_name_ = L"My profile 2"; |
57 profile_2_path_ = CreateProfileDirectory(profile_2_name_); | 57 profile_2_path_ = CreateProfileDirectory(profile_2_name_); |
58 profile_3_name_ = L"My profile 3"; | 58 profile_3_name_ = L"My profile 3"; |
59 profile_3_path_ = CreateProfileDirectory(profile_3_name_); | 59 profile_3_path_ = CreateProfileDirectory(profile_3_name_); |
60 } | 60 } |
61 | 61 |
62 virtual void TearDown() OVERRIDE { | 62 virtual void TearDown() override { |
63 message_loop_.RunUntilIdle(); | 63 message_loop_.RunUntilIdle(); |
64 | 64 |
65 // Delete all profiles and ensure their shortcuts got removed. | 65 // Delete all profiles and ensure their shortcuts got removed. |
66 const int num_profiles = profile_info_cache_->GetNumberOfProfiles(); | 66 const int num_profiles = profile_info_cache_->GetNumberOfProfiles(); |
67 for (int i = 0; i < num_profiles; ++i) { | 67 for (int i = 0; i < num_profiles; ++i) { |
68 const base::FilePath profile_path = | 68 const base::FilePath profile_path = |
69 profile_info_cache_->GetPathOfProfileAtIndex(0); | 69 profile_info_cache_->GetPathOfProfileAtIndex(0); |
70 base::string16 profile_name = | 70 base::string16 profile_name = |
71 profile_info_cache_->GetNameOfProfileAtIndex(0); | 71 profile_info_cache_->GetNameOfProfileAtIndex(0); |
72 profile_info_cache_->DeleteProfileFromCache(profile_path); | 72 profile_info_cache_->DeleteProfileFromCache(profile_path); |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 EXPECT_NE(unbadged_icon_1, new_badged_icon_1); | 865 EXPECT_NE(unbadged_icon_1, new_badged_icon_1); |
866 | 866 |
867 // Ensure the icon doesn't change on avatar change without 2 profiles. | 867 // Ensure the icon doesn't change on avatar change without 2 profiles. |
868 profile_info_cache_->SetAvatarIconOfProfileAtIndex(profile_index_1, 1); | 868 profile_info_cache_->SetAvatarIconOfProfileAtIndex(profile_index_1, 1); |
869 RunPendingTasks(); | 869 RunPendingTasks(); |
870 | 870 |
871 std::string unbadged_icon_1_a; | 871 std::string unbadged_icon_1_a; |
872 EXPECT_TRUE(base::ReadFileToString(icon_path_1, &unbadged_icon_1_a)); | 872 EXPECT_TRUE(base::ReadFileToString(icon_path_1, &unbadged_icon_1_a)); |
873 EXPECT_EQ(unbadged_icon_1, unbadged_icon_1_a); | 873 EXPECT_EQ(unbadged_icon_1, unbadged_icon_1_a); |
874 } | 874 } |
OLD | NEW |