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/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 class CreateVisualElementsManifestTest : public testing::Test { | 35 class CreateVisualElementsManifestTest : public testing::Test { |
36 protected: | 36 protected: |
37 void SetUp() override { | 37 void SetUp() override { |
38 // Create a temp directory for testing. | 38 // Create a temp directory for testing. |
39 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 39 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
40 | 40 |
41 version_ = base::Version("0.0.0.0"); | 41 version_ = Version("0.0.0.0"); |
42 | 42 |
43 version_dir_ = test_dir_.path().AppendASCII(version_.GetString()); | 43 version_dir_ = test_dir_.path().AppendASCII(version_.GetString()); |
44 ASSERT_TRUE(base::CreateDirectory(version_dir_)); | 44 ASSERT_TRUE(base::CreateDirectory(version_dir_)); |
45 | 45 |
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 void TearDown() override { | 50 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 base::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 base::Version version_; | 59 Version version_; |
60 | 60 |
61 // The path to |test_dir_|\|version_|. | 61 // The path to |test_dir_|\|version_|. |
62 base::FilePath version_dir_; | 62 base::FilePath version_dir_; |
63 | 63 |
64 // The path to VisualElementsManifest.xml. | 64 // The path to VisualElementsManifest.xml. |
65 base::FilePath manifest_path_; | 65 base::FilePath manifest_path_; |
66 }; | 66 }; |
67 | 67 |
68 class InstallShortcutTest : public testing::Test { | 68 class InstallShortcutTest : public testing::Test { |
69 protected: | 69 protected: |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 440 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
441 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 441 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
442 } | 442 } |
443 | 443 |
444 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { | 444 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { |
445 base::string16 val(L"Google Chrome"); | 445 base::string16 val(L"Google Chrome"); |
446 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; | 446 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; |
447 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 447 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
448 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 448 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
449 } | 449 } |
OLD | NEW |