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 <objbase.h> | 5 #include <objbase.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/path_service.h" | 13 #include "base/path_service.h" |
13 #include "base/platform_file.h" | 14 #include "base/platform_file.h" |
14 #include "base/scoped_temp_dir.h" | |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "base/test/scoped_path_override.h" | 16 #include "base/test/scoped_path_override.h" |
17 #include "base/test/test_shortcut_win.h" | 17 #include "base/test/test_shortcut_win.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "base/version.h" | 19 #include "base/version.h" |
20 #include "base/win/shortcut.h" | 20 #include "base/win/shortcut.h" |
21 #include "chrome/installer/setup/install.h" | 21 #include "chrome/installer/setup/install.h" |
22 #include "chrome/installer/setup/install_worker.h" | 22 #include "chrome/installer/setup/install_worker.h" |
23 #include "chrome/installer/setup/setup_constants.h" | 23 #include "chrome/installer/setup/setup_constants.h" |
24 #include "chrome/installer/util/browser_distribution.h" | 24 #include "chrome/installer/util/browser_distribution.h" |
(...skipping 21 matching lines...) Expand all Loading... |
46 manifest_path_ = | 46 manifest_path_ = |
47 test_dir_.path().Append(installer::kVisualElementsManifest); | 47 test_dir_.path().Append(installer::kVisualElementsManifest); |
48 } | 48 } |
49 | 49 |
50 virtual void TearDown() OVERRIDE { | 50 virtual void TearDown() OVERRIDE { |
51 // Clean up test directory manually so we can fail if it leaks. | 51 // Clean up test directory manually so we can fail if it leaks. |
52 ASSERT_TRUE(test_dir_.Delete()); | 52 ASSERT_TRUE(test_dir_.Delete()); |
53 } | 53 } |
54 | 54 |
55 // The temporary directory used to contain the test operations. | 55 // The temporary directory used to contain the test operations. |
56 ScopedTempDir test_dir_; | 56 base::ScopedTempDir test_dir_; |
57 | 57 |
58 // A dummy version number used to create the version directory. | 58 // A dummy version number used to create the version directory. |
59 Version version_; | 59 Version version_; |
60 | 60 |
61 // The path to |test_dir_|\|version_|. | 61 // The path to |test_dir_|\|version_|. |
62 FilePath version_dir_; | 62 FilePath version_dir_; |
63 | 63 |
64 // The path to VisualElementsManifest.xml. | 64 // The path to VisualElementsManifest.xml. |
65 FilePath manifest_path_; | 65 FilePath manifest_path_; |
66 }; | 66 }; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 } | 178 } |
179 | 179 |
180 base::win::ShortcutProperties expected_properties_; | 180 base::win::ShortcutProperties expected_properties_; |
181 base::win::ShortcutProperties expected_start_menu_properties_; | 181 base::win::ShortcutProperties expected_start_menu_properties_; |
182 | 182 |
183 BrowserDistribution* dist_; | 183 BrowserDistribution* dist_; |
184 FilePath chrome_exe_; | 184 FilePath chrome_exe_; |
185 scoped_ptr<installer::Product> product_; | 185 scoped_ptr<installer::Product> product_; |
186 scoped_ptr<installer::MasterPreferences> prefs_; | 186 scoped_ptr<installer::MasterPreferences> prefs_; |
187 | 187 |
188 ScopedTempDir temp_dir_; | 188 base::ScopedTempDir temp_dir_; |
189 ScopedTempDir fake_user_desktop_; | 189 base::ScopedTempDir fake_user_desktop_; |
190 ScopedTempDir fake_common_desktop_; | 190 base::ScopedTempDir fake_common_desktop_; |
191 ScopedTempDir fake_user_quick_launch_; | 191 base::ScopedTempDir fake_user_quick_launch_; |
192 ScopedTempDir fake_default_user_quick_launch_; | 192 base::ScopedTempDir fake_default_user_quick_launch_; |
193 ScopedTempDir fake_start_menu_; | 193 base::ScopedTempDir fake_start_menu_; |
194 ScopedTempDir fake_common_start_menu_; | 194 base::ScopedTempDir fake_common_start_menu_; |
195 scoped_ptr<base::ScopedPathOverride> user_desktop_override_; | 195 scoped_ptr<base::ScopedPathOverride> user_desktop_override_; |
196 scoped_ptr<base::ScopedPathOverride> common_desktop_override_; | 196 scoped_ptr<base::ScopedPathOverride> common_desktop_override_; |
197 scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; | 197 scoped_ptr<base::ScopedPathOverride> user_quick_launch_override_; |
198 scoped_ptr<base::ScopedPathOverride> default_user_quick_launch_override_; | 198 scoped_ptr<base::ScopedPathOverride> default_user_quick_launch_override_; |
199 scoped_ptr<base::ScopedPathOverride> start_menu_override_; | 199 scoped_ptr<base::ScopedPathOverride> start_menu_override_; |
200 scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; | 200 scoped_ptr<base::ScopedPathOverride> common_start_menu_override_; |
201 | 201 |
202 FilePath user_desktop_shortcut_; | 202 FilePath user_desktop_shortcut_; |
203 FilePath user_quick_launch_shortcut_; | 203 FilePath user_quick_launch_shortcut_; |
204 FilePath user_start_menu_shortcut_; | 204 FilePath user_start_menu_shortcut_; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 428 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
429 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 429 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
430 } | 430 } |
431 | 431 |
432 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { | 432 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { |
433 string16 val(L"Google Chrome"); | 433 string16 val(L"Google Chrome"); |
434 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; | 434 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; |
435 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 435 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
436 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 436 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
437 } | 437 } |
OLD | NEW |