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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 496 |
497 TEST_F(ProfileManagerTest, LastOpenedProfilesDoesNotContainIncognito) { | 497 TEST_F(ProfileManagerTest, LastOpenedProfilesDoesNotContainIncognito) { |
498 FilePath dest_path1 = temp_dir_.path(); | 498 FilePath dest_path1 = temp_dir_.path(); |
499 dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); | 499 dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); |
500 FilePath dest_path2 = temp_dir_.path(); | 500 FilePath dest_path2 = temp_dir_.path(); |
501 dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); | 501 dest_path2 = dest_path2.Append(FILE_PATH_LITERAL("New Profile 2")); |
502 | 502 |
503 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 503 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
504 | 504 |
505 // Successfully create the profiles. | 505 // Successfully create the profiles. |
506 Profile* profile1 = profile_manager->GetProfile(dest_path1); | 506 TestingProfile* profile1 = |
| 507 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); |
507 ASSERT_TRUE(profile1); | 508 ASSERT_TRUE(profile1); |
508 | 509 |
509 TestingProfile* profile2 = | 510 // incognito profiles should not be managed by the profile manager but by the |
510 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 511 // original profile. |
| 512 TestingProfile* profile2 = new TestingProfile(); |
511 ASSERT_TRUE(profile2); | 513 ASSERT_TRUE(profile2); |
512 profile2->set_incognito(true); | 514 profile2->set_incognito(true); |
| 515 profile1->SetOffTheRecordProfile(profile2); |
513 | 516 |
514 std::vector<Profile*> last_opened_profiles = | 517 std::vector<Profile*> last_opened_profiles = |
515 profile_manager->GetLastOpenedProfiles(); | 518 profile_manager->GetLastOpenedProfiles(); |
516 ASSERT_EQ(0U, last_opened_profiles.size()); | 519 ASSERT_EQ(0U, last_opened_profiles.size()); |
517 | 520 |
518 // Create a browser for profile1. | 521 // Create a browser for profile1. |
519 scoped_ptr<Browser> browser1(new Browser(Browser::TYPE_TABBED, profile1)); | 522 scoped_ptr<Browser> browser1(new Browser(Browser::TYPE_TABBED, profile1)); |
520 | 523 |
521 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 524 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
522 ASSERT_EQ(1U, last_opened_profiles.size()); | 525 ASSERT_EQ(1U, last_opened_profiles.size()); |
(...skipping 21 matching lines...) Expand all Loading... |
544 browser2b.reset(); | 547 browser2b.reset(); |
545 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 548 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
546 ASSERT_EQ(1U, last_opened_profiles.size()); | 549 ASSERT_EQ(1U, last_opened_profiles.size()); |
547 EXPECT_EQ(profile1, last_opened_profiles[0]); | 550 EXPECT_EQ(profile1, last_opened_profiles[0]); |
548 | 551 |
549 browser1.reset(); | 552 browser1.reset(); |
550 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 553 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
551 ASSERT_EQ(0U, last_opened_profiles.size()); | 554 ASSERT_EQ(0U, last_opened_profiles.size()); |
552 } | 555 } |
553 #endif // !defined(OS_ANDROID) | 556 #endif // !defined(OS_ANDROID) |
OLD | NEW |