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

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

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