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

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

Issue 1542413002: Switch to standard integer types in chrome/browser/, part 1 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 <stddef.h>
5 #include <stdint.h> 6 #include <stdint.h>
6 #include <vector> 7 #include <vector>
7 8
8 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // children when its destructor is called (at the end of each test). 80 // children when its destructor is called (at the end of each test).
80 const base::DictionaryValue manifest; 81 const base::DictionaryValue manifest;
81 ASSERT_FALSE(traits_.VerifyInstallation(manifest, temp_dir_.path())); 82 ASSERT_FALSE(traits_.VerifyInstallation(manifest, temp_dir_.path()));
82 const base::FilePath data_file_dir = 83 const base::FilePath data_file_dir =
83 temp_dir_.path() 84 temp_dir_.path()
84 .Append(FILE_PATH_LITERAL("_platform_specific")) 85 .Append(FILE_PATH_LITERAL("_platform_specific"))
85 .Append(FILE_PATH_LITERAL("all")); 86 .Append(FILE_PATH_LITERAL("all"));
86 ASSERT_TRUE(base::CreateDirectory(data_file_dir)); 87 ASSERT_TRUE(base::CreateDirectory(data_file_dir));
87 const base::FilePath data_file = data_file_dir.Append(kTestCldDataFileName); 88 const base::FilePath data_file = data_file_dir.Append(kTestCldDataFileName);
88 const std::string test_data("fake cld2 data file content here :)"); 89 const std::string test_data("fake cld2 data file content here :)");
89 ASSERT_EQ(static_cast<int32>(test_data.length()), 90 ASSERT_EQ(static_cast<int32_t>(test_data.length()),
90 base::WriteFile(data_file, test_data.c_str(), test_data.length())); 91 base::WriteFile(data_file, test_data.c_str(), test_data.length()));
91 ASSERT_TRUE(traits_.VerifyInstallation(manifest, temp_dir_.path())); 92 ASSERT_TRUE(traits_.VerifyInstallation(manifest, temp_dir_.path()));
92 } 93 }
93 94
94 TEST_F(CldComponentInstallerTest, OnCustomInstall) { 95 TEST_F(CldComponentInstallerTest, OnCustomInstall) {
95 const base::DictionaryValue manifest; 96 const base::DictionaryValue manifest;
96 const base::FilePath install_dir; 97 const base::FilePath install_dir;
97 // Sanity: shouldn't crash. 98 // Sanity: shouldn't crash.
98 ASSERT_TRUE(traits_.OnCustomInstall(manifest, install_dir)); 99 ASSERT_TRUE(traits_.OnCustomInstall(manifest, install_dir));
99 } 100 }
(...skipping 28 matching lines...) Expand all
128 traits_.ComponentReady(version, install_dir, manifest.Pass()); 129 traits_.ComponentReady(version, install_dir, manifest.Pass());
129 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile(); 130 base::FilePath result = CldComponentInstallerTraits::GetLatestCldDataFile();
130 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(), 131 ASSERT_TRUE(base::StartsWith(result.AsUTF16Unsafe(),
131 install_dir.AsUTF16Unsafe(), 132 install_dir.AsUTF16Unsafe(),
132 base::CompareCase::SENSITIVE)); 133 base::CompareCase::SENSITIVE));
133 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName, 134 ASSERT_TRUE(base::EndsWith(result.value(), kTestCldDataFileName,
134 base::CompareCase::SENSITIVE)); 135 base::CompareCase::SENSITIVE));
135 } 136 }
136 137
137 } // namespace component_updater 138 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698