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

Side by Side Diff: content/common/font_warmup_win_unittest.cc

Issue 1507413003: clang/win: Let some chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: content_browsertests Created 5 years 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 | « content/common/cursors/webcursor.cc ('k') | content/common/sandbox_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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/common/font_warmup_win.h" 5 #include "content/common/font_warmup_win.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 249
250 TEST(GDIFontEmulationTest, CreateDeleteDCSuccess) { 250 TEST(GDIFontEmulationTest, CreateDeleteDCSuccess) {
251 if (base::win::GetVersion() < base::win::VERSION_WIN8) 251 if (base::win::GetVersion() < base::win::VERSION_WIN8)
252 return; 252 return;
253 TestSkFontMgr fontmgr; 253 TestSkFontMgr fontmgr;
254 scoped_ptr<GdiFontPatchData> patch_data(SetupTest()); 254 scoped_ptr<GdiFontPatchData> patch_data(SetupTest());
255 EXPECT_FALSE(!patch_data); 255 EXPECT_FALSE(!patch_data);
256 256
257 HDC hdc = CreateCompatibleDC(0); 257 HDC hdc = CreateCompatibleDC(0);
258 EXPECT_NE(hdc, nullptr); 258 EXPECT_NE(hdc, nullptr);
259 EXPECT_EQ(GetEmulatedGdiHandleCountForTesting(), 1); 259 EXPECT_EQ(1u, GetEmulatedGdiHandleCountForTesting());
260 EXPECT_TRUE(DeleteDC(hdc)); 260 EXPECT_TRUE(DeleteDC(hdc));
261 EXPECT_EQ(GetEmulatedGdiHandleCountForTesting(), 0); 261 EXPECT_EQ(0u, GetEmulatedGdiHandleCountForTesting());
262 } 262 }
263 263
264 TEST(GDIFontEmulationTest, CreateUniqueDCSuccess) { 264 TEST(GDIFontEmulationTest, CreateUniqueDCSuccess) {
265 if (base::win::GetVersion() < base::win::VERSION_WIN8) 265 if (base::win::GetVersion() < base::win::VERSION_WIN8)
266 return; 266 return;
267 TestSkFontMgr fontmgr; 267 TestSkFontMgr fontmgr;
268 scoped_ptr<GdiFontPatchData> patch_data(SetupTest()); 268 scoped_ptr<GdiFontPatchData> patch_data(SetupTest());
269 EXPECT_NE(patch_data, nullptr); 269 EXPECT_NE(patch_data, nullptr);
270 270
271 HDC hdc1 = CreateCompatibleDC(0); 271 HDC hdc1 = CreateCompatibleDC(0);
272 EXPECT_NE(hdc1, nullptr); 272 EXPECT_NE(hdc1, nullptr);
273 HDC hdc2 = CreateCompatibleDC(0); 273 HDC hdc2 = CreateCompatibleDC(0);
274 EXPECT_NE(hdc2, nullptr); 274 EXPECT_NE(hdc2, nullptr);
275 EXPECT_NE(hdc1, hdc2); 275 EXPECT_NE(hdc1, hdc2);
276 EXPECT_TRUE(DeleteDC(hdc2)); 276 EXPECT_TRUE(DeleteDC(hdc2));
277 EXPECT_EQ(GetEmulatedGdiHandleCountForTesting(), 1); 277 EXPECT_EQ(1u, GetEmulatedGdiHandleCountForTesting());
278 EXPECT_TRUE(DeleteDC(hdc1)); 278 EXPECT_TRUE(DeleteDC(hdc1));
279 EXPECT_EQ(GetEmulatedGdiHandleCountForTesting(), 0); 279 EXPECT_EQ(0u, GetEmulatedGdiHandleCountForTesting());
280 } 280 }
281 281
282 TEST(GDIFontEmulationTest, CreateFontSuccess) { 282 TEST(GDIFontEmulationTest, CreateFontSuccess) {
283 if (base::win::GetVersion() < base::win::VERSION_WIN8) 283 if (base::win::GetVersion() < base::win::VERSION_WIN8)
284 return; 284 return;
285 TestSkFontMgr fontmgr; 285 TestSkFontMgr fontmgr;
286 scoped_ptr<GdiFontPatchData> patch_data(SetupTest()); 286 scoped_ptr<GdiFontPatchData> patch_data(SetupTest());
287 EXPECT_NE(patch_data, nullptr); 287 EXPECT_NE(patch_data, nullptr);
288 LOGFONTW logfont = {0}; 288 LOGFONTW logfont = {0};
289 InitLogFont(&logfont, kTestFontFamilyW); 289 InitLogFont(&logfont, kTestFontFamilyW);
290 HFONT font = CreateFontIndirectW(&logfont); 290 HFONT font = CreateFontIndirectW(&logfont);
291 EXPECT_NE(font, nullptr); 291 EXPECT_NE(font, nullptr);
292 EXPECT_TRUE(DeleteObject(font)); 292 EXPECT_TRUE(DeleteObject(font));
293 EXPECT_EQ(GetEmulatedGdiHandleCountForTesting(), 0); 293 EXPECT_EQ(0u, GetEmulatedGdiHandleCountForTesting());
294 } 294 }
295 295
296 TEST(GDIFontEmulationTest, CreateFontFailure) { 296 TEST(GDIFontEmulationTest, CreateFontFailure) {
297 if (base::win::GetVersion() < base::win::VERSION_WIN8) 297 if (base::win::GetVersion() < base::win::VERSION_WIN8)
298 return; 298 return;
299 TestSkFontMgr fontmgr; 299 TestSkFontMgr fontmgr;
300 scoped_ptr<GdiFontPatchData> patch_data(SetupTest()); 300 scoped_ptr<GdiFontPatchData> patch_data(SetupTest());
301 EXPECT_NE(patch_data, nullptr); 301 EXPECT_NE(patch_data, nullptr);
302 LOGFONTW logfont = {0}; 302 LOGFONTW logfont = {0};
303 InitLogFont(&logfont, kTestFontFamilyInvalid); 303 InitLogFont(&logfont, kTestFontFamilyInvalid);
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 DWORD data_size = static_cast<DWORD>(strlen(kTestFontData)); 423 DWORD data_size = static_cast<DWORD>(strlen(kTestFontData));
424 std::vector<char> data(data_size); 424 std::vector<char> data(data_size);
425 DWORD size = GetFontData(hdc, kTestFontTableTag, 0, &data[0], data.size()); 425 DWORD size = GetFontData(hdc, kTestFontTableTag, 0, &data[0], data.size());
426 EXPECT_EQ(size, data_size); 426 EXPECT_EQ(size, data_size);
427 EXPECT_EQ(memcmp(&data[0], kTestFontData, data.size()), 0); 427 EXPECT_EQ(memcmp(&data[0], kTestFontData, data.size()), 0);
428 EXPECT_TRUE(DeleteObject(font)); 428 EXPECT_TRUE(DeleteObject(font));
429 EXPECT_TRUE(DeleteDC(hdc)); 429 EXPECT_TRUE(DeleteDC(hdc));
430 } 430 }
431 431
432 } // namespace content 432 } // namespace content
OLDNEW
« no previous file with comments | « content/common/cursors/webcursor.cc ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698