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

Side by Side Diff: ppapi/tests/test_graphics_2d.cc

Issue 14087009: Verify that the image is not empty before calling memset(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@missing-include-for-epoll-io
Patch Set: Created 7 years, 8 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 | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/tests/test_graphics_2d.h" 5 #include "ppapi/tests/test_graphics_2d.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 std::string TestGraphics2D::TestInitToZero() { 314 std::string TestGraphics2D::TestInitToZero() {
315 const int w = 15, h = 17; 315 const int w = 15, h = 17;
316 pp::Graphics2D dc(instance_, pp::Size(w, h), false); 316 pp::Graphics2D dc(instance_, pp::Size(w, h), false);
317 ASSERT_FALSE(dc.is_null()); 317 ASSERT_FALSE(dc.is_null());
318 318
319 // Make an image with nonzero data in it (so we can test that zeros were 319 // Make an image with nonzero data in it (so we can test that zeros were
320 // actually read versus ReadImageData being a NOP). 320 // actually read versus ReadImageData being a NOP).
321 pp::ImageData image(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL, 321 pp::ImageData image(instance_, PP_IMAGEDATAFORMAT_BGRA_PREMUL,
322 pp::Size(w, h), true); 322 pp::Size(w, h), true);
323 ASSERT_FALSE(image.is_null()); 323 ASSERT_FALSE(image.is_null());
324 ASSERT_FALSE(image.size().IsEmpty());
324 memset(image.data(), 0xFF, image.stride() * image.size().height() * 4); 325 memset(image.data(), 0xFF, image.stride() * image.size().height() * 4);
325 326
326 // Read out the initial data from the device & check. 327 // Read out the initial data from the device & check.
327 ASSERT_TRUE(ReadImageData(dc, &image, pp::Point(0, 0))); 328 ASSERT_TRUE(ReadImageData(dc, &image, pp::Point(0, 0)));
328 ASSERT_TRUE(IsSquareInImage(image, 0, pp::Rect(0, 0, w, h), 0)); 329 ASSERT_TRUE(IsSquareInImage(image, 0, pp::Rect(0, 0, w, h), 0));
329 330
330 PASS(); 331 PASS();
331 } 332 }
332 333
333 std::string TestGraphics2D::TestDescribe() { 334 std::string TestGraphics2D::TestDescribe() {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 pp::Graphics2D dc(instance_, pp::Size(w, h), false); 808 pp::Graphics2D dc(instance_, pp::Size(w, h), false);
808 ASSERT_FALSE(dc.is_null()); 809 ASSERT_FALSE(dc.is_null());
809 ASSERT_TRUE(instance_->BindGraphics(dc)); 810 ASSERT_TRUE(instance_->BindGraphics(dc));
810 811
811 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D())); 812 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D()));
812 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D())); 813 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D()));
813 814
814 PASS(); 815 PASS();
815 } 816 }
816 817
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698