| 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 "chrome/installer/setup/install.h" | 5 #include "chrome/installer/setup/install.h" |
| 6 | 6 |
| 7 #include <objbase.h> | 7 #include <objbase.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 EXPECT_TRUE(base::NormalizeFilePath(path, &normalized_path)); | 42 EXPECT_TRUE(base::NormalizeFilePath(path, &normalized_path)); |
| 43 return normalized_path; | 43 return normalized_path; |
| 44 } | 44 } |
| 45 | 45 |
| 46 class CreateVisualElementsManifestTest : public testing::Test { | 46 class CreateVisualElementsManifestTest : public testing::Test { |
| 47 protected: | 47 protected: |
| 48 void SetUp() override { | 48 void SetUp() override { |
| 49 // Create a temp directory for testing. | 49 // Create a temp directory for testing. |
| 50 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 50 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
| 51 | 51 |
| 52 version_ = Version("0.0.0.0"); | 52 version_ = base::Version("0.0.0.0"); |
| 53 | 53 |
| 54 version_dir_ = test_dir_.path().AppendASCII(version_.GetString()); | 54 version_dir_ = test_dir_.path().AppendASCII(version_.GetString()); |
| 55 ASSERT_TRUE(base::CreateDirectory(version_dir_)); | 55 ASSERT_TRUE(base::CreateDirectory(version_dir_)); |
| 56 | 56 |
| 57 manifest_path_ = | 57 manifest_path_ = |
| 58 test_dir_.path().Append(installer::kVisualElementsManifest); | 58 test_dir_.path().Append(installer::kVisualElementsManifest); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TearDown() override { | 61 void TearDown() override { |
| 62 // Clean up test directory manually so we can fail if it leaks. | 62 // Clean up test directory manually so we can fail if it leaks. |
| 63 ASSERT_TRUE(test_dir_.Delete()); | 63 ASSERT_TRUE(test_dir_.Delete()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // The temporary directory used to contain the test operations. | 66 // The temporary directory used to contain the test operations. |
| 67 base::ScopedTempDir test_dir_; | 67 base::ScopedTempDir test_dir_; |
| 68 | 68 |
| 69 // A dummy version number used to create the version directory. | 69 // A dummy version number used to create the version directory. |
| 70 Version version_; | 70 base::Version version_; |
| 71 | 71 |
| 72 // The path to |test_dir_|\|version_|. | 72 // The path to |test_dir_|\|version_|. |
| 73 base::FilePath version_dir_; | 73 base::FilePath version_dir_; |
| 74 | 74 |
| 75 // The path to VisualElementsManifest.xml. | 75 // The path to VisualElementsManifest.xml. |
| 76 base::FilePath manifest_path_; | 76 base::FilePath manifest_path_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 class InstallShortcutTest : public testing::Test { | 79 class InstallShortcutTest : public testing::Test { |
| 80 protected: | 80 protected: |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 814 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
| 815 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 815 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
| 816 } | 816 } |
| 817 | 817 |
| 818 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { | 818 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { |
| 819 base::string16 val(L"Google Chrome"); | 819 base::string16 val(L"Google Chrome"); |
| 820 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; | 820 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; |
| 821 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 821 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
| 822 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 822 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
| 823 } | 823 } |
| OLD | NEW |