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