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

Side by Side Diff: base/file_version_info_unittest.cc

Issue 1218243002: Fix some clang warnings with -Wmissing-braces in base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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
« no previous file with comments | « no previous file | base/files/memory_mapped_file_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_version_info.h" 5 #include "base/file_version_info.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 14 matching lines...) Expand all
25 path = path.AppendASCII("data"); 25 path = path.AppendASCII("data");
26 path = path.AppendASCII("file_version_info_unittest"); 26 path = path.AppendASCII("file_version_info_unittest");
27 return path; 27 return path;
28 } 28 }
29 #endif 29 #endif
30 30
31 } // namespace 31 } // namespace
32 32
33 #if defined(OS_WIN) 33 #if defined(OS_WIN)
34 TEST(FileVersionInfoTest, HardCodedProperties) { 34 TEST(FileVersionInfoTest, HardCodedProperties) {
35 const wchar_t* kDLLNames[] = { 35 const wchar_t kDLLName[] = {L"FileVersionInfoTest1.dll"};
36 L"FileVersionInfoTest1.dll" 36
37 const wchar_t* const kExpectedValues[15] = {
38 // FileVersionInfoTest.dll
39 L"Goooooogle", // company_name
40 L"Google", // company_short_name
41 L"This is the product name", // product_name
42 L"This is the product short name", // product_short_name
43 L"The Internal Name", // internal_name
44 L"4.3.2.1", // product_version
45 L"Private build property", // private_build
46 L"Special build property", // special_build
47 L"This is a particularly interesting comment", // comments
48 L"This is the original filename", // original_filename
49 L"This is my file description", // file_description
50 L"1.2.3.4", // file_version
51 L"This is the legal copyright", // legal_copyright
52 L"This is the legal trademarks", // legal_trademarks
53 L"This is the last change", // last_change
37 }; 54 };
38 55
39 const wchar_t* kExpectedValues[1][15] = { 56 FilePath dll_path = GetTestDataPath();
40 // FileVersionInfoTest.dll 57 dll_path = dll_path.Append(kDLLName);
41 L"Goooooogle", // company_name
42 L"Google", // company_short_name
43 L"This is the product name", // product_name
44 L"This is the product short name", // product_short_name
45 L"The Internal Name", // internal_name
46 L"4.3.2.1", // product_version
47 L"Private build property", // private_build
48 L"Special build property", // special_build
49 L"This is a particularly interesting comment", // comments
50 L"This is the original filename", // original_filename
51 L"This is my file description", // file_description
52 L"1.2.3.4", // file_version
53 L"This is the legal copyright", // legal_copyright
54 L"This is the legal trademarks", // legal_trademarks
55 L"This is the last change", // last_change
56 };
57 58
58 for (int i = 0; i < arraysize(kDLLNames); ++i) { 59 scoped_ptr<FileVersionInfo> version_info(
59 FilePath dll_path = GetTestDataPath(); 60 FileVersionInfo::CreateFileVersionInfo(dll_path));
60 dll_path = dll_path.Append(kDLLNames[i]);
61 61
62 scoped_ptr<FileVersionInfo> version_info( 62 int j = 0;
63 FileVersionInfo::CreateFileVersionInfo(dll_path)); 63 EXPECT_EQ(kExpectedValues[j++], version_info->company_name());
64 64 EXPECT_EQ(kExpectedValues[j++], version_info->company_short_name());
65 int j = 0; 65 EXPECT_EQ(kExpectedValues[j++], version_info->product_name());
66 EXPECT_EQ(kExpectedValues[i][j++], version_info->company_name()); 66 EXPECT_EQ(kExpectedValues[j++], version_info->product_short_name());
67 EXPECT_EQ(kExpectedValues[i][j++], version_info->company_short_name()); 67 EXPECT_EQ(kExpectedValues[j++], version_info->internal_name());
68 EXPECT_EQ(kExpectedValues[i][j++], version_info->product_name()); 68 EXPECT_EQ(kExpectedValues[j++], version_info->product_version());
69 EXPECT_EQ(kExpectedValues[i][j++], version_info->product_short_name()); 69 EXPECT_EQ(kExpectedValues[j++], version_info->private_build());
70 EXPECT_EQ(kExpectedValues[i][j++], version_info->internal_name()); 70 EXPECT_EQ(kExpectedValues[j++], version_info->special_build());
71 EXPECT_EQ(kExpectedValues[i][j++], version_info->product_version()); 71 EXPECT_EQ(kExpectedValues[j++], version_info->comments());
72 EXPECT_EQ(kExpectedValues[i][j++], version_info->private_build()); 72 EXPECT_EQ(kExpectedValues[j++], version_info->original_filename());
73 EXPECT_EQ(kExpectedValues[i][j++], version_info->special_build()); 73 EXPECT_EQ(kExpectedValues[j++], version_info->file_description());
74 EXPECT_EQ(kExpectedValues[i][j++], version_info->comments()); 74 EXPECT_EQ(kExpectedValues[j++], version_info->file_version());
75 EXPECT_EQ(kExpectedValues[i][j++], version_info->original_filename()); 75 EXPECT_EQ(kExpectedValues[j++], version_info->legal_copyright());
76 EXPECT_EQ(kExpectedValues[i][j++], version_info->file_description()); 76 EXPECT_EQ(kExpectedValues[j++], version_info->legal_trademarks());
77 EXPECT_EQ(kExpectedValues[i][j++], version_info->file_version()); 77 EXPECT_EQ(kExpectedValues[j++], version_info->last_change());
78 EXPECT_EQ(kExpectedValues[i][j++], version_info->legal_copyright());
79 EXPECT_EQ(kExpectedValues[i][j++], version_info->legal_trademarks());
80 EXPECT_EQ(kExpectedValues[i][j++], version_info->last_change());
81 }
82 } 78 }
83 #endif 79 #endif
84 80
85 #if defined(OS_WIN) 81 #if defined(OS_WIN)
86 TEST(FileVersionInfoTest, IsOfficialBuild) { 82 TEST(FileVersionInfoTest, IsOfficialBuild) {
87 const wchar_t* kDLLNames[] = { 83 const wchar_t* kDLLNames[] = {
88 L"FileVersionInfoTest1.dll", 84 L"FileVersionInfoTest1.dll",
89 L"FileVersionInfoTest2.dll" 85 L"FileVersionInfoTest2.dll"
90 }; 86 };
91 87
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 EXPECT_TRUE(version_info_win->GetValue(L"Custom prop 3", &str)); 128 EXPECT_TRUE(version_info_win->GetValue(L"Custom prop 3", &str));
133 EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043", str); 129 EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043", str);
134 EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043", 130 EXPECT_EQ(L"1600 Amphitheatre Parkway Mountain View, CA 94043",
135 version_info_win->GetStringValue(L"Custom prop 3")); 131 version_info_win->GetStringValue(L"Custom prop 3"));
136 132
137 // Test an non-existing property. 133 // Test an non-existing property.
138 EXPECT_FALSE(version_info_win->GetValue(L"Unknown property", &str)); 134 EXPECT_FALSE(version_info_win->GetValue(L"Unknown property", &str));
139 EXPECT_EQ(L"", version_info_win->GetStringValue(L"Unknown property")); 135 EXPECT_EQ(L"", version_info_win->GetStringValue(L"Unknown property"));
140 } 136 }
141 #endif 137 #endif
OLDNEW
« no previous file with comments | « no previous file | base/files/memory_mapped_file_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698