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

Side by Side Diff: chrome/browser/background/background_mode_manager_unittest.cc

Issue 9020013: Refactor ProfileInfoCacheObserver interface and usage thereof. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: changed remaining callbacks to use only profile_path where possible Created 9 years 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 | Annotate | Revision Log
OLDNEW
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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/background/background_mode_manager.h" 8 #include "chrome/browser/background/background_mode_manager.h"
9 #include "chrome/browser/profiles/profile_info_cache.h" 9 #include "chrome/browser/profiles/profile_info_cache.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 EXPECT_FALSE(BrowserList::WillKeepAlive()); 259 EXPECT_FALSE(BrowserList::WillKeepAlive());
260 260
261 ProfileInfoCache* cache = profile_manager_.profile_info_cache(); 261 ProfileInfoCache* cache = profile_manager_.profile_info_cache();
262 262
263 // Install app, should show status tray icon. 263 // Install app, should show status tray icon.
264 manager.OnBackgroundAppInstalled(NULL); 264 manager.OnBackgroundAppInstalled(NULL);
265 manager.SetBackgroundAppCount(1); 265 manager.SetBackgroundAppCount(1);
266 manager.SetBackgroundAppCountForProfile(1); 266 manager.SetBackgroundAppCountForProfile(1);
267 manager.OnApplicationListChanged(profile1); 267 manager.OnApplicationListChanged(profile1);
268 268
269 string16 p1name = cache->GetNameOfProfileAtIndex(0); 269 manager.OnProfileNameChanged(
270 manager.OnProfileNameChanged(p1name, UTF8ToUTF16("p1new")); 270 profile1->GetPath(),
271 manager.GetBackgroundModeData(profile1)->name());
271 272
272 EXPECT_EQ(UTF8ToUTF16("p1new"), 273 EXPECT_EQ(UTF8ToUTF16("p1"),
273 manager.GetBackgroundModeData(profile1)->name()); 274 manager.GetBackgroundModeData(profile1)->name());
274 275
275 TestingProfile* profile2 = profile_manager_.CreateTestingProfile("p2"); 276 TestingProfile* profile2 = profile_manager_.CreateTestingProfile("p2");
276 manager.RegisterProfile(profile2); 277 manager.RegisterProfile(profile2);
277 EXPECT_EQ(2, manager.NumberOfBackgroundModeData()); 278 EXPECT_EQ(2, manager.NumberOfBackgroundModeData());
278 279
279 gfx::Image gaia_image(gfx::test::CreateImage()); 280 manager.OnProfileAdded(profile2->GetPath());
280 manager.OnProfileAdded(UTF8ToUTF16("p2new"), 281 EXPECT_EQ(UTF8ToUTF16("p2"),
281 profile2->GetPath().BaseName().LossyDisplayName(),
282 profile2->GetPath(),
283 &gaia_image);
284 EXPECT_EQ(UTF8ToUTF16("p2new"),
285 manager.GetBackgroundModeData(profile2)->name()); 282 manager.GetBackgroundModeData(profile2)->name());
286 283
287 manager.OnProfileWillBeRemoved(UTF8ToUTF16("p2new")); 284 manager.OnProfileWillBeRemoved(profile2->GetPath());
288 EXPECT_EQ(1, manager.NumberOfBackgroundModeData()); 285 EXPECT_EQ(1, manager.NumberOfBackgroundModeData());
289 286
290 // Check that the background mode data we think is in the map actually is. 287 // Check that the background mode data we think is in the map actually is.
291 EXPECT_EQ(UTF8ToUTF16("p1new"), 288 EXPECT_EQ(UTF8ToUTF16("p1"),
292 manager.GetBackgroundModeData(profile1)->name()); 289 manager.GetBackgroundModeData(profile1)->name());
293 } 290 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698