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

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

Issue 10826144: Delete both regular and Metro user data dirs on uninstall. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 "chrome/installer/util/product_unittest.h" 5 #include "chrome/installer/util/product_unittest.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/test/test_reg_util_win.h" 8 #include "base/test/test_reg_util_win.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/common/chrome_constants.h"
10 #include "chrome/installer/util/chrome_frame_distribution.h" 11 #include "chrome/installer/util/chrome_frame_distribution.h"
11 #include "chrome/installer/util/google_update_constants.h" 12 #include "chrome/installer/util/google_update_constants.h"
12 #include "chrome/installer/util/installation_state.h" 13 #include "chrome/installer/util/installation_state.h"
13 #include "chrome/installer/util/installer_state.h" 14 #include "chrome/installer/util/installer_state.h"
14 #include "chrome/installer/util/master_preferences.h" 15 #include "chrome/installer/util/master_preferences.h"
15 #include "chrome/installer/util/product.h" 16 #include "chrome/installer/util/product.h"
16 17
17 using base::win::RegKey; 18 using base::win::RegKey;
18 using installer::Product; 19 using installer::Product;
19 using installer::MasterPreferences; 20 using installer::MasterPreferences;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 installer::MasterPreferences prefs(cmd_line); 64 installer::MasterPreferences prefs(cmd_line);
64 installer::InstallationState machine_state; 65 installer::InstallationState machine_state;
65 machine_state.Initialize(); 66 machine_state.Initialize();
66 installer::InstallerState installer_state; 67 installer::InstallerState installer_state;
67 installer_state.Initialize(cmd_line, prefs, machine_state); 68 installer_state.Initialize(cmd_line, prefs, machine_state);
68 69
69 const Product* product = installer_state.products()[0]; 70 const Product* product = installer_state.products()[0];
70 BrowserDistribution* distribution = product->distribution(); 71 BrowserDistribution* distribution = product->distribution();
71 EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType()); 72 EXPECT_EQ(BrowserDistribution::CHROME_BROWSER, distribution->GetType());
72 73
73 FilePath user_data(product->GetUserDataPath()); 74 std::vector<FilePath> user_data_paths;
74 EXPECT_FALSE(user_data.empty()); 75 product->GetUserDataPaths(&user_data_paths);
76 EXPECT_LE(static_cast<size_t>(1), user_data_paths.size());
gab 2012/08/03 17:54:20 In comparisons don't we usually put the constant o
grt (UTC plus 2) 2012/08/03 20:18:37 I'm following the pattern of EXPECT_EQ; see http:/
gab 2012/08/03 21:58:57 Yea I realize that, it makes sense for me to do it
77 const FilePath& user_data = user_data_paths[0];
78 EXPECT_FALSE(user_data_paths[0].empty());
75 EXPECT_NE(std::wstring::npos, 79 EXPECT_NE(std::wstring::npos,
76 user_data.value().find(installer::kInstallUserDataDir)); 80 user_data_paths[0].value().find(installer::kInstallUserDataDir));
81 if (user_data_paths.size() > 1) {
82 EXPECT_FALSE(user_data_paths[1].empty());
83 EXPECT_NE(
84 std::wstring::npos,
85 user_data_paths[1].value().find(chrome::kMetroChromeUserDataSubDir));
86 }
77 87
78 FilePath program_files; 88 FilePath program_files;
79 PathService::Get(base::DIR_PROGRAM_FILES, &program_files); 89 PathService::Get(base::DIR_PROGRAM_FILES, &program_files);
80 // The User Data path should never be under program files, even though 90 // The User Data path should never be under program files, even though
81 // system_level is true. 91 // system_level is true.
82 EXPECT_EQ(std::wstring::npos, 92 EXPECT_EQ(std::wstring::npos,
83 user_data.value().find(program_files.value())); 93 user_data.value().find(program_files.value()));
84 94
85 // There should be no installed version in the registry. 95 // There should be no installed version in the registry.
86 machine_state.Initialize(); 96 machine_state.Initialize();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (chrome_state != NULL) 137 if (chrome_state != NULL)
128 EXPECT_TRUE(chrome_state->is_msi()); 138 EXPECT_TRUE(chrome_state->is_msi());
129 } 139 }
130 } 140 }
131 141
132 TEST_F(ProductTest, LaunchChrome) { 142 TEST_F(ProductTest, LaunchChrome) {
133 // TODO(tommi): Test Product::LaunchChrome and 143 // TODO(tommi): Test Product::LaunchChrome and
134 // Product::LaunchChromeAndWait. 144 // Product::LaunchChromeAndWait.
135 LOG(ERROR) << "Test not implemented."; 145 LOG(ERROR) << "Test not implemented.";
136 } 146 }
OLDNEW
« chrome/installer/util/helper.cc ('K') | « chrome/installer/util/product.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698