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

Side by Side Diff: ui/surface/accelerated_surface_transformer_win_unittest.cc

Issue 12217101: Replace FilePath with base::FilePath in some more top level directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/shell_dialogs/selected_file_info.cc ('k') | ui/surface/d3d9_utils_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <d3d9.h> 5 #include <d3d9.h>
6 #include <random> 6 #include <random>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/hash.h" 10 #include "base/hash.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 *result.getAddr32(x, y) = row32[x] | 0xFF000000; 62 *result.getAddr32(x, y) = row32[x] | 0xFF000000;
63 } 63 }
64 } 64 }
65 } 65 }
66 result.unlockPixels(); 66 result.unlockPixels();
67 result.setImmutable(); 67 result.setImmutable();
68 surface->UnlockRect(); 68 surface->UnlockRect();
69 return result; 69 return result;
70 } 70 }
71 71
72 bool WritePNGFile(const SkBitmap& bitmap, const FilePath& file_path) { 72 bool WritePNGFile(const SkBitmap& bitmap, const base::FilePath& file_path) {
73 std::vector<unsigned char> png_data; 73 std::vector<unsigned char> png_data;
74 const bool discard_transparency = true; 74 const bool discard_transparency = true;
75 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, 75 if (gfx::PNGCodec::EncodeBGRASkBitmap(bitmap,
76 discard_transparency, 76 discard_transparency,
77 &png_data) && 77 &png_data) &&
78 file_util::CreateDirectory(file_path.DirName())) { 78 file_util::CreateDirectory(file_path.DirName())) {
79 char* data = reinterpret_cast<char*>(&png_data[0]); 79 char* data = reinterpret_cast<char*>(&png_data[0]);
80 int size = static_cast<int>(png_data.size()); 80 int size = static_cast<int>(png_data.size());
81 return file_util::WriteFile(file_path, data, size) == size; 81 return file_util::WriteFile(file_path, data, size) == size;
82 } 82 }
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // Check for equality of the reference and the actual. 545 // Check for equality of the reference and the actual.
546 AssertSame(dst_size.width(), dst_size.height(), &reference_y[0], dst_y); 546 AssertSame(dst_size.width(), dst_size.height(), &reference_y[0], dst_y);
547 AssertSame(uv_size.width(), uv_size.height(), &reference_u[0], dst_u); 547 AssertSame(uv_size.width(), uv_size.height(), &reference_u[0], dst_u);
548 AssertSame(uv_size.width(), uv_size.height(), &reference_v[0], dst_v); 548 AssertSame(uv_size.width(), uv_size.height(), &reference_v[0], dst_v);
549 549
550 if (kDumpImagesOnFailure && HasFatalFailure()) { 550 if (kDumpImagesOnFailure && HasFatalFailure()) {
551 // Note that this will dump the full u and v buffers, including 551 // Note that this will dump the full u and v buffers, including
552 // extra columns added due to packing. That means up to 7 extra 552 // extra columns added due to packing. That means up to 7 extra
553 // columns for uv, and up to 3 extra columns for y. 553 // columns for uv, and up to 3 extra columns for y.
554 WritePNGFile(reference_rgb, 554 WritePNGFile(reference_rgb,
555 FilePath(FILE_PATH_LITERAL("test_fail_src.png"))); 555 base::FilePath(FILE_PATH_LITERAL("test_fail_src.png")));
556 WritePNGFile(reference_rgb_scaled, 556 WritePNGFile(reference_rgb_scaled,
557 FilePath(FILE_PATH_LITERAL("test_fail_src_scaled.png"))); 557 base::FilePath(
558 FILE_PATH_LITERAL("test_fail_src_scaled.png")));
558 WritePNGFile(ToSkBitmap(dst_y, true), 559 WritePNGFile(ToSkBitmap(dst_y, true),
559 FilePath(FILE_PATH_LITERAL("test_fail_y.png"))); 560 base::FilePath(FILE_PATH_LITERAL("test_fail_y.png")));
560 WritePNGFile(ToSkBitmap(dst_u, true), 561 WritePNGFile(ToSkBitmap(dst_u, true),
561 FilePath(FILE_PATH_LITERAL("test_fail_u.png"))); 562 base::FilePath(FILE_PATH_LITERAL("test_fail_u.png")));
562 WritePNGFile(ToSkBitmap(dst_v, true), 563 WritePNGFile(ToSkBitmap(dst_v, true),
563 FilePath(FILE_PATH_LITERAL("test_fail_v.png"))); 564 base::FilePath(FILE_PATH_LITERAL("test_fail_v.png")));
564 } 565 }
565 } 566 }
566 567
567 int color_error_tolerance_; 568 int color_error_tolerance_;
568 uniform_int_distribution<DWORD> random_dword_; 569 uniform_int_distribution<DWORD> random_dword_;
569 std::mt19937 rng_; 570 std::mt19937 rng_;
570 base::ScopedNativeLibrary d3d_module_; 571 base::ScopedNativeLibrary d3d_module_;
571 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_; 572 base::win::ScopedComPtr<IDirect3DDevice9Ex> device_;
572 }; 573 };
573 574
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 result.push_back(base::win::GetVersion()); 882 result.push_back(base::win::GetVersion());
882 } 883 }
883 return result; 884 return result;
884 } 885 }
885 886
886 } // namespace 887 } // namespace
887 888
888 INSTANTIATE_TEST_CASE_P(VistaAndUp, 889 INSTANTIATE_TEST_CASE_P(VistaAndUp,
889 AcceleratedSurfaceTransformerTest, 890 AcceleratedSurfaceTransformerTest,
890 ::testing::ValuesIn(WindowsVersionIfVistaOrBetter())); 891 ::testing::ValuesIn(WindowsVersionIfVistaOrBetter()));
OLDNEW
« no previous file with comments | « ui/shell_dialogs/selected_file_info.cc ('k') | ui/surface/d3d9_utils_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698