Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_unittest.cc

Issue 508813002: Move ownership of the AppListViewDelegate into the AppListService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/pref_service_factory.h" 10 #include "base/prefs/pref_service_factory.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::FilePath initial_profile_path = 150 base::FilePath initial_profile_path =
151 user_data_dir_.AppendASCII(chrome::kInitialProfile); 151 user_data_dir_.AppendASCII(chrome::kInitialProfile);
152 EXPECT_EQ(initial_profile_path, 152 EXPECT_EQ(initial_profile_path,
153 service_->GetProfilePath(profile_store_->GetUserDataDir())); 153 service_->GetProfilePath(profile_store_->GetUserDataDir()));
154 } 154 }
155 155
156 TEST_F(AppListServiceUnitTest, 156 TEST_F(AppListServiceUnitTest,
157 RemovedProfileResetsToLastUsedProfileIfExists) { 157 RemovedProfileResetsToLastUsedProfileIfExists) {
158 local_state_->SetString(prefs::kProfileLastUsed, "last-used"); 158 local_state_->SetString(prefs::kProfileLastUsed, "last-used");
159 EnableAppList(); 159 EnableAppList();
160 EXPECT_EQ(0, service_->destroy_app_list_call_count());
161 profile_store_->RemoveProfile(profile1_.get()); 160 profile_store_->RemoveProfile(profile1_.get());
162 161
163 base::FilePath last_used_profile_path = 162 base::FilePath last_used_profile_path =
164 user_data_dir_.AppendASCII("last-used"); 163 user_data_dir_.AppendASCII("last-used");
165 EXPECT_EQ(last_used_profile_path, 164 EXPECT_EQ(last_used_profile_path,
166 service_->GetProfilePath(profile_store_->GetUserDataDir())); 165 service_->GetProfilePath(profile_store_->GetUserDataDir()));
167 166
168 // Ensure a tear-down was triggered, since there would be references to the 167 // For this test, the AppListViewDelegate is not created because the
169 // destroyed Profile, and the last-used profile could be getting loaded 168 // app list is never shown, so there is nothing to destroy.
170 // asynchronously. 169 EXPECT_EQ(0, service_->destroy_app_list_call_count());
171 EXPECT_EQ(1, service_->destroy_app_list_call_count());
172 } 170 }
173 171
174 TEST_F(AppListServiceUnitTest, SwitchingProfilesPersists) { 172 TEST_F(AppListServiceUnitTest, SwitchingProfilesPersists) {
175 profile_store_->LoadProfile(profile1_.get()); 173 profile_store_->LoadProfile(profile1_.get());
176 profile_store_->LoadProfile(profile2_.get()); 174 profile_store_->LoadProfile(profile2_.get());
177 EnableAppList(); 175 EnableAppList();
178 service_->SetProfilePath(profile2_->GetPath()); 176 service_->SetProfilePath(profile2_->GetPath());
179 service_->Show(); 177 service_->Show();
180 EXPECT_EQ(profile2_.get(), service_->showing_for_profile()); 178 EXPECT_EQ(profile2_.get(), service_->showing_for_profile());
181 EXPECT_EQ(profile2_->GetPath(), 179 EXPECT_EQ(profile2_->GetPath(),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL, 241 EXPECT_EQ(AppListService::ENABLE_FOR_APP_INSTALL,
244 local_state_->GetInteger(prefs::kAppListEnableMethod)); 242 local_state_->GetInteger(prefs::kAppListEnableMethod));
245 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime)); 243 EXPECT_NE(0, local_state_->GetInt64(prefs::kAppListEnableTime));
246 244
247 // An auto-show here should update the enable method to prevent recording it 245 // An auto-show here should update the enable method to prevent recording it
248 // as ENABLE_FOR_APP_INSTALL. 246 // as ENABLE_FOR_APP_INSTALL.
249 service_->AutoShowForProfile(profile1_.get()); 247 service_->AutoShowForProfile(profile1_.get());
250 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED, 248 EXPECT_EQ(AppListService::ENABLE_SHOWN_UNDISCOVERED,
251 local_state_->GetInteger(prefs::kAppListEnableMethod)); 249 local_state_->GetInteger(prefs::kAppListEnableMethod));
252 } 250 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_mac.mm ('k') | chrome/browser/ui/app_list/app_list_service_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698