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

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 16174003: Make all tests use GetActiveDesktop() instead of hardcoding HOST_DESKTOP_TYPE_NATIVE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months 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) 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/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 468
469 TestingProfile* profile2 = 469 TestingProfile* profile2 =
470 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); 470 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2));
471 ASSERT_TRUE(profile2); 471 ASSERT_TRUE(profile2);
472 472
473 std::vector<Profile*> last_opened_profiles = 473 std::vector<Profile*> last_opened_profiles =
474 profile_manager->GetLastOpenedProfiles(); 474 profile_manager->GetLastOpenedProfiles();
475 ASSERT_EQ(0U, last_opened_profiles.size()); 475 ASSERT_EQ(0U, last_opened_profiles.size());
476 476
477 // Create a browser for profile1. 477 // Create a browser for profile1.
478 Browser::CreateParams profile1_params(profile1, 478 Browser::CreateParams profile1_params(profile1, chrome::GetActiveDesktop());
479 chrome::HOST_DESKTOP_TYPE_NATIVE);
480 scoped_ptr<Browser> browser1a( 479 scoped_ptr<Browser> browser1a(
481 chrome::CreateBrowserWithTestWindowForParams(&profile1_params)); 480 chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
482 481
483 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 482 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
484 ASSERT_EQ(1U, last_opened_profiles.size()); 483 ASSERT_EQ(1U, last_opened_profiles.size());
485 EXPECT_EQ(profile1, last_opened_profiles[0]); 484 EXPECT_EQ(profile1, last_opened_profiles[0]);
486 485
487 // And for profile2. 486 // And for profile2.
488 Browser::CreateParams profile2_params(profile2, 487 Browser::CreateParams profile2_params(profile2, chrome::GetActiveDesktop());
489 chrome::HOST_DESKTOP_TYPE_NATIVE);
490 scoped_ptr<Browser> browser2( 488 scoped_ptr<Browser> browser2(
491 chrome::CreateBrowserWithTestWindowForParams(&profile2_params)); 489 chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
492 490
493 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 491 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
494 ASSERT_EQ(2U, last_opened_profiles.size()); 492 ASSERT_EQ(2U, last_opened_profiles.size());
495 EXPECT_EQ(profile1, last_opened_profiles[0]); 493 EXPECT_EQ(profile1, last_opened_profiles[0]);
496 EXPECT_EQ(profile2, last_opened_profiles[1]); 494 EXPECT_EQ(profile2, last_opened_profiles[1]);
497 495
498 // Adding more browsers doesn't change anything. 496 // Adding more browsers doesn't change anything.
499 scoped_ptr<Browser> browser1b( 497 scoped_ptr<Browser> browser1b(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 // Successfully create the profiles. 530 // Successfully create the profiles.
533 TestingProfile* profile1 = 531 TestingProfile* profile1 =
534 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); 532 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1));
535 ASSERT_TRUE(profile1); 533 ASSERT_TRUE(profile1);
536 534
537 TestingProfile* profile2 = 535 TestingProfile* profile2 =
538 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); 536 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2));
539 ASSERT_TRUE(profile2); 537 ASSERT_TRUE(profile2);
540 538
541 // Create a browser for profile1. 539 // Create a browser for profile1.
542 Browser::CreateParams profile1_params(profile1, 540 Browser::CreateParams profile1_params(profile1, chrome::GetActiveDesktop());
543 chrome::HOST_DESKTOP_TYPE_NATIVE);
544 scoped_ptr<Browser> browser1( 541 scoped_ptr<Browser> browser1(
545 chrome::CreateBrowserWithTestWindowForParams(&profile1_params)); 542 chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
546 543
547 // And for profile2. 544 // And for profile2.
548 Browser::CreateParams profile2_params(profile2, 545 Browser::CreateParams profile2_params(profile2, chrome::GetActiveDesktop());
549 chrome::HOST_DESKTOP_TYPE_NATIVE);
550 scoped_ptr<Browser> browser2( 546 scoped_ptr<Browser> browser2(
551 chrome::CreateBrowserWithTestWindowForParams(&profile2_params)); 547 chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
552 548
553 std::vector<Profile*> last_opened_profiles = 549 std::vector<Profile*> last_opened_profiles =
554 profile_manager->GetLastOpenedProfiles(); 550 profile_manager->GetLastOpenedProfiles();
555 ASSERT_EQ(2U, last_opened_profiles.size()); 551 ASSERT_EQ(2U, last_opened_profiles.size());
556 EXPECT_EQ(profile1, last_opened_profiles[0]); 552 EXPECT_EQ(profile1, last_opened_profiles[0]);
557 EXPECT_EQ(profile2, last_opened_profiles[1]); 553 EXPECT_EQ(profile2, last_opened_profiles[1]);
558 554
559 // Simulate a shutdown. 555 // Simulate a shutdown.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 TestingProfile* profile2 = new TestingProfile(); 587 TestingProfile* profile2 = new TestingProfile();
592 ASSERT_TRUE(profile2); 588 ASSERT_TRUE(profile2);
593 profile2->set_incognito(true); 589 profile2->set_incognito(true);
594 profile1->SetOffTheRecordProfile(profile2); 590 profile1->SetOffTheRecordProfile(profile2);
595 591
596 std::vector<Profile*> last_opened_profiles = 592 std::vector<Profile*> last_opened_profiles =
597 profile_manager->GetLastOpenedProfiles(); 593 profile_manager->GetLastOpenedProfiles();
598 ASSERT_EQ(0U, last_opened_profiles.size()); 594 ASSERT_EQ(0U, last_opened_profiles.size());
599 595
600 // Create a browser for profile1. 596 // Create a browser for profile1.
601 Browser::CreateParams profile1_params(profile1, 597 Browser::CreateParams profile1_params(profile1, chrome::GetActiveDesktop());
602 chrome::HOST_DESKTOP_TYPE_NATIVE);
603 scoped_ptr<Browser> browser1( 598 scoped_ptr<Browser> browser1(
604 chrome::CreateBrowserWithTestWindowForParams(&profile1_params)); 599 chrome::CreateBrowserWithTestWindowForParams(&profile1_params));
605 600
606 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 601 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
607 ASSERT_EQ(1U, last_opened_profiles.size()); 602 ASSERT_EQ(1U, last_opened_profiles.size());
608 EXPECT_EQ(profile1, last_opened_profiles[0]); 603 EXPECT_EQ(profile1, last_opened_profiles[0]);
609 604
610 // And for profile2. 605 // And for profile2.
611 Browser::CreateParams profile2_params(profile2, 606 Browser::CreateParams profile2_params(profile2, chrome::GetActiveDesktop());
612 chrome::HOST_DESKTOP_TYPE_NATIVE);
613 scoped_ptr<Browser> browser2a( 607 scoped_ptr<Browser> browser2a(
614 chrome::CreateBrowserWithTestWindowForParams(&profile2_params)); 608 chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
615 609
616 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 610 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
617 ASSERT_EQ(1U, last_opened_profiles.size()); 611 ASSERT_EQ(1U, last_opened_profiles.size());
618 EXPECT_EQ(profile1, last_opened_profiles[0]); 612 EXPECT_EQ(profile1, last_opened_profiles[0]);
619 613
620 // Adding more browsers doesn't change anything. 614 // Adding more browsers doesn't change anything.
621 scoped_ptr<Browser> browser2b( 615 scoped_ptr<Browser> browser2b(
622 chrome::CreateBrowserWithTestWindowForParams(&profile2_params)); 616 chrome::CreateBrowserWithTestWindowForParams(&profile2_params));
(...skipping 10 matching lines...) Expand all
633 browser2b.reset(); 627 browser2b.reset();
634 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 628 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
635 ASSERT_EQ(1U, last_opened_profiles.size()); 629 ASSERT_EQ(1U, last_opened_profiles.size());
636 EXPECT_EQ(profile1, last_opened_profiles[0]); 630 EXPECT_EQ(profile1, last_opened_profiles[0]);
637 631
638 browser1.reset(); 632 browser1.reset();
639 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); 633 last_opened_profiles = profile_manager->GetLastOpenedProfiles();
640 ASSERT_EQ(0U, last_opened_profiles.size()); 634 ASSERT_EQ(0U, last_opened_profiles.size());
641 } 635 }
642 #endif // !defined(OS_ANDROID) 636 #endif // !defined(OS_ANDROID)
OLDNEW
« no previous file with comments | « chrome/browser/profiles/avatar_menu_model_browsertest.cc ('k') | chrome/browser/sync/test/integration/sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698