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

Side by Side Diff: cc/test/pixel_test.cc

Issue 12558003: cc: Made image comparison for pixel tests error tolerant. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added output of error pixel details. Created 7 years, 9 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 | « cc/test/pixel_test.h ('k') | cc/test/pixel_test_utils.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/test/pixel_test.h" 5 #include "cc/test/pixel_test.h"
6 6
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "cc/output/compositor_frame_metadata.h" 8 #include "cc/output/compositor_frame_metadata.h"
9 #include "cc/output/gl_renderer.h" 9 #include "cc/output/gl_renderer.h"
10 #include "cc/output/output_surface.h" 10 #include "cc/output/output_surface.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 output_surface_.get(), 69 output_surface_.get(),
70 resource_provider_.get()); 70 resource_provider_.get());
71 71
72 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts = 72 scoped_refptr<webkit::gpu::ContextProviderInProcess> offscreen_contexts =
73 webkit::gpu::ContextProviderInProcess::Create(); 73 webkit::gpu::ContextProviderInProcess::Create();
74 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread()); 74 ASSERT_TRUE(offscreen_contexts->BindToCurrentThread());
75 resource_provider_->set_offscreen_context_provider(offscreen_contexts); 75 resource_provider_->set_offscreen_context_provider(offscreen_contexts);
76 } 76 }
77 77
78 bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file, 78 bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file,
79 bool discard_transparency) { 79 const PixelComparator& comparator) {
80 gfx::Rect device_viewport_rect(device_viewport_size_); 80 gfx::Rect device_viewport_rect(device_viewport_size_);
81 81
82 SkBitmap bitmap; 82 SkBitmap bitmap;
83 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 83 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
84 device_viewport_rect.width(), 84 device_viewport_rect.width(),
85 device_viewport_rect.height()); 85 device_viewport_rect.height());
86 bitmap.allocPixels(); 86 bitmap.allocPixels();
87 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels()); 87 unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels());
88 renderer_->GetFramebufferPixels(pixels, device_viewport_rect); 88 renderer_->GetFramebufferPixels(pixels, device_viewport_rect);
89 89
90 base::FilePath test_data_dir; 90 base::FilePath test_data_dir;
91 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir)) 91 if (!PathService::Get(cc::DIR_TEST_DATA, &test_data_dir))
92 return false; 92 return false;
93 93
94 // To rebaseline: 94 // To rebaseline:
95 // return WritePNGFile(bitmap, test_data_dir.Append(ref_file)); 95 // return WritePNGFile(bitmap, test_data_dir.Append(ref_file));
96 96
97 return IsSameAsPNGFile(bitmap, test_data_dir.Append(ref_file), 97 return MatchesPNGFile(bitmap, test_data_dir.Append(ref_file), comparator);
98 discard_transparency);
99 } 98 }
100 99
101 } // namespace cc 100 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/pixel_test.h ('k') | cc/test/pixel_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698