| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 const base::FilePath::CharType kTestCldDataFileName[] = | 26 const base::FilePath::CharType kTestCldDataFileName[] = |
| 27 FILE_PATH_LITERAL("cld2_data.bin"); | 27 FILE_PATH_LITERAL("cld2_data.bin"); |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 namespace component_updater { | 31 namespace component_updater { |
| 32 | 32 |
| 33 class CldComponentInstallerTest : public PlatformTest { | 33 class CldComponentInstallerTest : public PlatformTest { |
| 34 public: | 34 public: |
| 35 CldComponentInstallerTest() {} | 35 CldComponentInstallerTest() {} |
| 36 virtual void SetUp() override { | 36 void SetUp() override { |
| 37 PlatformTest::SetUp(); | 37 PlatformTest::SetUp(); |
| 38 | 38 |
| 39 // ScopedTempDir automatically does a recursive delete on the entire | 39 // ScopedTempDir automatically does a recursive delete on the entire |
| 40 // directory in its destructor, so no cleanup is required in TearDown. | 40 // directory in its destructor, so no cleanup is required in TearDown. |
| 41 // Note that all files created by this test case are created within the | 41 // Note that all files created by this test case are created within the |
| 42 // directory that is created here, so even though they are not explicitly | 42 // directory that is created here, so even though they are not explicitly |
| 43 // created *as temp files*, they will still get cleaned up automagically. | 43 // created *as temp files*, they will still get cleaned up automagically. |
| 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 44 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 45 | 45 |
| 46 // The "latest CLD data file" is a static piece of information, and thus | 46 // The "latest CLD data file" is a static piece of information, and thus |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 traits_.ComponentReady(version, install_dir, manifest.Pass()); | 119 traits_.ComponentReady(version, install_dir, manifest.Pass()); |
| 120 base::FilePath result = | 120 base::FilePath result = |
| 121 CldComponentInstallerTraits::GetLatestCldDataFile(); | 121 CldComponentInstallerTraits::GetLatestCldDataFile(); |
| 122 ASSERT_TRUE(StartsWith(result.AsUTF16Unsafe(), | 122 ASSERT_TRUE(StartsWith(result.AsUTF16Unsafe(), |
| 123 install_dir.AsUTF16Unsafe(), | 123 install_dir.AsUTF16Unsafe(), |
| 124 true)); | 124 true)); |
| 125 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); | 125 ASSERT_TRUE(EndsWith(result.value(), kTestCldDataFileName, true)); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace component_updater | 128 } // namespace component_updater |
| OLD | NEW |