OLD | NEW |
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 "chrome/browser/profiles/profile_info_cache_unittest.h" | 5 #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 gaia_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); | 292 gaia_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); |
293 | 293 |
294 // Don't use GAIA picture as profile picture. | 294 // Don't use GAIA picture as profile picture. |
295 GetCache()->SetIsUsingGAIAPictureOfProfileAtIndex(1, false); | 295 GetCache()->SetIsUsingGAIAPictureOfProfileAtIndex(1, false); |
296 EXPECT_TRUE(gfx::test::IsEqual( | 296 EXPECT_TRUE(gfx::test::IsEqual( |
297 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(1))); | 297 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(1))); |
298 EXPECT_TRUE(gfx::test::IsEqual( | 298 EXPECT_TRUE(gfx::test::IsEqual( |
299 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); | 299 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(1))); |
300 } | 300 } |
301 | 301 |
302 #if defined(USE_AURA) | 302 TEST_F(ProfileInfoCacheTest, PersistGAIAPicture) { |
303 #define MAYBE_PersistGAIAPicture DISABLED_PersistGAIAPicture | |
304 #else | |
305 #define MAYBE_PersistGAIAPicture PersistGAIAPicture | |
306 #endif | |
307 | |
308 TEST_F(ProfileInfoCacheTest, MAYBE_PersistGAIAPicture) { | |
309 GetCache()->AddProfileToCache( | 303 GetCache()->AddProfileToCache( |
310 GetProfilePath("path_1"), ASCIIToUTF16("name_1"), string16(), 0); | 304 GetProfilePath("path_1"), ASCIIToUTF16("name_1"), string16(), 0); |
311 gfx::Image gaia_image(gfx::test::CreateImage()); | 305 gfx::Image gaia_image(gfx::test::CreateImage()); |
312 | 306 |
313 ui_test_utils::WindowedNotificationObserver save_observer( | 307 ui_test_utils::WindowedNotificationObserver save_observer( |
314 chrome::NOTIFICATION_PROFILE_CACHE_PICTURE_SAVED, | 308 chrome::NOTIFICATION_PROFILE_CACHE_PICTURE_SAVED, |
315 content::NotificationService::AllSources()); | 309 content::NotificationService::AllSources()); |
316 GetCache()->SetGAIAPictureOfProfileAtIndex(0, &gaia_image); | 310 GetCache()->SetGAIAPictureOfProfileAtIndex(0, &gaia_image); |
317 EXPECT_TRUE(gfx::test::IsEqual( | 311 EXPECT_TRUE(gfx::test::IsEqual( |
318 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(0))); | 312 gaia_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(0))); |
(...skipping 28 matching lines...) Expand all Loading... |
347 GetCache()->SetIsUsingGAIANameOfProfileAtIndex(0, true); | 341 GetCache()->SetIsUsingGAIANameOfProfileAtIndex(0, true); |
348 GetCache()->SetIsUsingGAIAPictureOfProfileAtIndex(0, true); | 342 GetCache()->SetIsUsingGAIAPictureOfProfileAtIndex(0, true); |
349 | 343 |
350 // Verify that the profile name and picture are not empty. | 344 // Verify that the profile name and picture are not empty. |
351 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); | 345 EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(0)); |
352 EXPECT_TRUE(gfx::test::IsEqual( | 346 EXPECT_TRUE(gfx::test::IsEqual( |
353 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); | 347 profile_image, GetCache()->GetAvatarIconOfProfileAtIndex(0))); |
354 } | 348 } |
355 | 349 |
356 } // namespace | 350 } // namespace |
OLD | NEW |