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

Side by Side Diff: chrome/installer/util/installer_state_unittest.cc

Issue 115993006: Revert of Remove installation of Chrome Frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <windows.h> 5 #include <windows.h>
6 6
7 #include <fstream> 7 #include <fstream>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 void BuildSingleChromeState(const base::FilePath& target_dir, 76 void BuildSingleChromeState(const base::FilePath& target_dir,
77 MockInstallerState* installer_state) { 77 MockInstallerState* installer_state) {
78 CommandLine cmd_line = CommandLine::FromString(L"setup.exe"); 78 CommandLine cmd_line = CommandLine::FromString(L"setup.exe");
79 MasterPreferences prefs(cmd_line); 79 MasterPreferences prefs(cmd_line);
80 InstallationState machine_state; 80 InstallationState machine_state;
81 machine_state.Initialize(); 81 machine_state.Initialize();
82 installer_state->Initialize(cmd_line, prefs, machine_state); 82 installer_state->Initialize(cmd_line, prefs, machine_state);
83 installer_state->set_target_path(target_dir); 83 installer_state->set_target_path(target_dir);
84 EXPECT_TRUE(installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER) 84 EXPECT_TRUE(installer_state->FindProduct(BrowserDistribution::CHROME_BROWSER)
85 != NULL); 85 != NULL);
86 EXPECT_TRUE(installer_state->FindProduct(BrowserDistribution::CHROME_FRAME)
87 == NULL);
86 } 88 }
87 89
88 wchar_t text_content_1[] = L"delete me"; 90 wchar_t text_content_1[] = L"delete me";
89 wchar_t text_content_2[] = L"delete me as well"; 91 wchar_t text_content_2[] = L"delete me as well";
90 92
91 // Delete version directories. Everything lower than the given version 93 // Delete version directories. Everything lower than the given version
92 // should be deleted. 94 // should be deleted.
93 TEST_F(InstallerStateTest, Delete) { 95 TEST_F(InstallerStateTest, Delete) {
94 // TODO(grt): move common stuff into the test fixture. 96 // TODO(grt): move common stuff into the test fixture.
95 // Create a Chrome dir 97 // Create a Chrome dir
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 BrowserDistribution::GetSpecificDistribution( 623 BrowserDistribution::GetSpecificDistribution(
622 BrowserDistribution::CHROME_BINARIES)-> 624 BrowserDistribution::CHROME_BINARIES)->
623 GetInstallSubDir().c_str())); 625 GetInstallSubDir().c_str()));
624 EXPECT_FALSE(installer_state.verbose_logging()); 626 EXPECT_FALSE(installer_state.verbose_logging());
625 EXPECT_EQ(installer_state.state_key(), 627 EXPECT_EQ(installer_state.state_key(),
626 BrowserDistribution::GetSpecificDistribution( 628 BrowserDistribution::GetSpecificDistribution(
627 BrowserDistribution::CHROME_BROWSER)->GetStateKey()); 629 BrowserDistribution::CHROME_BROWSER)->GetStateKey());
628 EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_BROWSER); 630 EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_BROWSER);
629 EXPECT_TRUE(installer_state.multi_package_binaries_distribution()); 631 EXPECT_TRUE(installer_state.multi_package_binaries_distribution());
630 EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)); 632 EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER));
633 EXPECT_FALSE(installer_state.FindProduct(BrowserDistribution::CHROME_FRAME));
631 634
632 // Now initialize it to install system-level single Chrome. 635 // Now initialize it to install system-level single Chrome Frame.
633 { 636 {
634 CommandLine cmd_line( 637 CommandLine cmd_line(
635 CommandLine::FromString(L"setup.exe --system-level --verbose-logging")); 638 CommandLine::FromString(L"setup.exe --system-level --chrome-frame "
639 L"--verbose-logging"));
636 MasterPreferences prefs(cmd_line); 640 MasterPreferences prefs(cmd_line);
637 installer_state.Initialize(cmd_line, prefs, machine_state); 641 installer_state.Initialize(cmd_line, prefs, machine_state);
638 } 642 }
639 643
640 // Confirm that the old state is gone. 644 // Confirm that the old state is gone.
641 EXPECT_EQ(InstallerState::SYSTEM_LEVEL, installer_state.level()); 645 EXPECT_EQ(InstallerState::SYSTEM_LEVEL, installer_state.level());
642 EXPECT_EQ(InstallerState::SINGLE_PACKAGE, installer_state.package_type()); 646 EXPECT_EQ(InstallerState::SINGLE_PACKAGE, installer_state.package_type());
643 EXPECT_EQ(InstallerState::SINGLE_INSTALL_OR_UPDATE, 647 EXPECT_EQ(InstallerState::SINGLE_INSTALL_OR_UPDATE,
644 installer_state.operation()); 648 installer_state.operation());
645 EXPECT_TRUE(wcsstr(installer_state.target_path().value().c_str(), 649 EXPECT_TRUE(wcsstr(installer_state.target_path().value().c_str(),
646 BrowserDistribution::GetSpecificDistribution( 650 BrowserDistribution::GetSpecificDistribution(
647 BrowserDistribution::CHROME_BROWSER)-> 651 BrowserDistribution::CHROME_FRAME)->
648 GetInstallSubDir().c_str())); 652 GetInstallSubDir().c_str()));
649 EXPECT_TRUE(installer_state.verbose_logging()); 653 EXPECT_TRUE(installer_state.verbose_logging());
650 EXPECT_EQ(installer_state.state_key(), 654 // state_key and type are wrong in unittests since it is set based on the
651 BrowserDistribution::GetSpecificDistribution( 655 // current process's BrowserDistribution.
652 BrowserDistribution::CHROME_BROWSER)->GetStateKey()); 656 // EXPECT_EQ(installer_state.state_key(),
653 EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_BROWSER); 657 // BrowserDistribution::GetSpecificDistribution(
654 EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER)); 658 // BrowserDistribution::CHROME_FRAME)->GetStateKey());
659 // EXPECT_EQ(installer_state.state_type(), BrowserDistribution::CHROME_FRAME);
660 EXPECT_FALSE(
661 installer_state.FindProduct(BrowserDistribution::CHROME_BROWSER));
662 EXPECT_TRUE(installer_state.FindProduct(BrowserDistribution::CHROME_FRAME));
655 } 663 }
656 664
657 // A fixture for testing InstallerState::DetermineCriticalVersion. Individual 665 // A fixture for testing InstallerState::DetermineCriticalVersion. Individual
658 // tests must invoke Initialize() with a critical version. 666 // tests must invoke Initialize() with a critical version.
659 class InstallerStateCriticalVersionTest : public ::testing::Test { 667 class InstallerStateCriticalVersionTest : public ::testing::Test {
660 protected: 668 protected:
661 InstallerStateCriticalVersionTest() : cmd_line_(CommandLine::NO_PROGRAM) {} 669 InstallerStateCriticalVersionTest() : cmd_line_(CommandLine::NO_PROGRAM) {}
662 670
663 // Creates a set of versions for use by all test runs. 671 // Creates a set of versions for use by all test runs.
664 static void SetUpTestCase() { 672 static void SetUpTestCase() {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 // Critical update newer than the new version. 807 // Critical update newer than the new version.
800 EXPECT_FALSE( 808 EXPECT_FALSE(
801 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid()); 809 installer_state.DetermineCriticalVersion(NULL, *pv_version_).IsValid());
802 EXPECT_FALSE( 810 EXPECT_FALSE(
803 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_) 811 installer_state.DetermineCriticalVersion(opv_version_, *pv_version_)
804 .IsValid()); 812 .IsValid());
805 EXPECT_FALSE( 813 EXPECT_FALSE(
806 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_) 814 installer_state.DetermineCriticalVersion(pv_version_, *pv_version_)
807 .IsValid()); 815 .IsValid());
808 } 816 }
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state.cc ('k') | chrome/installer/util/logging_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698