Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: chrome/browser/component_updater/cld_component_installer_unittest.cc

Issue 1937683002: Implement support in DefaultComponentInstaller for picking up bundled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments through #35 Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/component_updater/cld_component_installer.h" 5 #include "chrome/browser/component_updater/cld_component_installer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 103 }
104 104
105 TEST_F(CldComponentInstallerTest, GetInstalledPath) { 105 TEST_F(CldComponentInstallerTest, GetInstalledPath) {
106 const base::FilePath base_dir; 106 const base::FilePath base_dir;
107 const base::FilePath result = 107 const base::FilePath result =
108 CldComponentInstallerTraits::GetInstalledPath(base_dir); 108 CldComponentInstallerTraits::GetInstalledPath(base_dir);
109 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, 109 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName,
110 base::CompareCase::SENSITIVE)); 110 base::CompareCase::SENSITIVE));
111 } 111 }
112 112
113 TEST_F(CldComponentInstallerTest, GetBaseDirectory) { 113 TEST_F(CldComponentInstallerTest, GetRelativeInstallDir) {
114 const base::FilePath result = traits_.GetBaseDirectory(); 114 ASSERT_FALSE(traits_.GetRelativeInstallDir().empty());
115 ASSERT_FALSE(result.empty());
116 } 115 }
117 116
118 TEST_F(CldComponentInstallerTest, GetHash) { 117 TEST_F(CldComponentInstallerTest, GetHash) {
119 std::vector<uint8_t> hash; 118 std::vector<uint8_t> hash;
120 traits_.GetHash(&hash); 119 traits_.GetHash(&hash);
121 ASSERT_EQ(static_cast<size_t>(32), hash.size()); 120 ASSERT_EQ(static_cast<size_t>(32), hash.size());
122 } 121 }
123 122
124 TEST_F(CldComponentInstallerTest, GetName) { 123 TEST_F(CldComponentInstallerTest, GetName) {
125 ASSERT_FALSE(traits_.GetName().empty()); 124 ASSERT_FALSE(traits_.GetName().empty());
126 } 125 }
127 126
128 TEST_F(CldComponentInstallerTest, ComponentReady) { 127 TEST_F(CldComponentInstallerTest, ComponentReady) {
129 std::unique_ptr<base::DictionaryValue> manifest; 128 std::unique_ptr<base::DictionaryValue> manifest;
130 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo")); 129 const base::FilePath install_dir(FILE_PATH_LITERAL("/foo"));
131 const base::Version version("1.2.3.4"); 130 const base::Version version("1.2.3.4");
132 traits_.ComponentReady(version, install_dir, std::move(manifest)); 131 traits_.ComponentReady(version, install_dir, std::move(manifest));
133 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); 132 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile();
134 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), 133 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(),
135 install_dir.AsUTF16Unsafe(), 134 install_dir.AsUTF16Unsafe(),
136 base::CompareCase::SENSITIVE)); 135 base::CompareCase::SENSITIVE));
137 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, 136 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName,
138 base::CompareCase::SENSITIVE)); 137 base::CompareCase::SENSITIVE));
139 } 138 }
140 139
141 } // namespace component_updater 140 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698