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_info_cache_unittest.h" | 5 #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) | 539 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS) |
540 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { | 540 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) { |
541 switches::EnableNewAvatarMenuForTesting( | 541 switches::EnableNewAvatarMenuForTesting( |
542 base::CommandLine::ForCurrentProcess()); | 542 base::CommandLine::ForCurrentProcess()); |
543 | 543 |
544 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); | 544 EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles()); |
545 base::FilePath path_1 = GetProfilePath("path_1"); | 545 base::FilePath path_1 = GetProfilePath("path_1"); |
546 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), | 546 GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"), |
547 base::string16(), 0, std::string()); | 547 base::string16(), 0, std::string()); |
548 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); | 548 EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles()); |
| 549 base::RunLoop().RunUntilIdle(); |
549 | 550 |
550 // We haven't downloaded any high-res avatars yet. | 551 // We haven't downloaded any high-res avatars yet. |
551 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); | 552 EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size()); |
552 | 553 |
553 // After adding a new profile, the download of high-res avatar will be | 554 // After adding a new profile, the download of high-res avatar will be |
554 // triggered if the flag kNewAvatarMenu has been set. But the downloader | 555 // triggered if the flag kNewAvatarMenu has been set. But the downloader |
555 // won't ever call OnFetchComplete in the test. | 556 // won't ever call OnFetchComplete in the test. |
556 EXPECT_EQ(1U, GetCache()->avatar_images_downloads_in_progress_.size()); | 557 EXPECT_EQ(1U, GetCache()->avatar_images_downloads_in_progress_.size()); |
557 | 558 |
558 EXPECT_FALSE(GetCache()->GetHighResAvatarOfProfileAtIndex(0)); | 559 EXPECT_FALSE(GetCache()->GetHighResAvatarOfProfileAtIndex(0)); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 // Profile names should have been preserved. | 670 // Profile names should have been preserved. |
670 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( | 671 EXPECT_EQ(name_1, GetCache()->GetNameOfProfileAtIndex( |
671 GetCache()->GetIndexOfProfileWithPath(path_1))); | 672 GetCache()->GetIndexOfProfileWithPath(path_1))); |
672 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( | 673 EXPECT_EQ(name_2, GetCache()->GetNameOfProfileAtIndex( |
673 GetCache()->GetIndexOfProfileWithPath(path_2))); | 674 GetCache()->GetIndexOfProfileWithPath(path_2))); |
674 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( | 675 EXPECT_EQ(name_3, GetCache()->GetNameOfProfileAtIndex( |
675 GetCache()->GetIndexOfProfileWithPath(path_3))); | 676 GetCache()->GetIndexOfProfileWithPath(path_3))); |
676 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( | 677 EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex( |
677 GetCache()->GetIndexOfProfileWithPath(path_4))); | 678 GetCache()->GetIndexOfProfileWithPath(path_4))); |
678 } | 679 } |
679 | |
OLD | NEW |