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_util.h" | 9 #include "base/file_util.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 virtual void SetUp() OVERRIDE { | 37 virtual 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_ = Version("0.0.0.0"); | 41 version_ = base::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 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 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 Version version_; | 59 base::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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 432 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
433 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 433 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
434 } | 434 } |
435 | 435 |
436 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { | 436 TEST(EscapeXmlAttributeValueTest, DontEscapeNormalValue) { |
437 base::string16 val(L"Google Chrome"); | 437 base::string16 val(L"Google Chrome"); |
438 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; | 438 static const wchar_t kExpectedEscapedVal[] = L"Google Chrome"; |
439 installer::EscapeXmlAttributeValueInSingleQuotes(&val); | 439 installer::EscapeXmlAttributeValueInSingleQuotes(&val); |
440 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); | 440 ASSERT_STREQ(kExpectedEscapedVal, val.c_str()); |
441 } | 441 } |
OLD | NEW |