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

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

Issue 12193015: PPAPI/NaCl: Make related tests run in 1 fixture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge 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 | « ppapi/tests/test_case.cc ('k') | ppapi/tests/test_input_event.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 "ppapi/tests/test_image_data.h" 5 #include "ppapi/tests/test_image_data.h"
6 6
7 #include "ppapi/cpp/graphics_2d.h" 7 #include "ppapi/cpp/graphics_2d.h"
8 #include "ppapi/cpp/image_data.h" 8 #include "ppapi/cpp/image_data.h"
9 #include "ppapi/cpp/instance.h" 9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module.h" 10 #include "ppapi/cpp/module.h"
11 #include "ppapi/tests/testing_instance.h" 11 #include "ppapi/tests/testing_instance.h"
12 12
13 REGISTER_TEST_CASE(ImageData); 13 REGISTER_TEST_CASE(ImageData);
14 14
15 bool TestImageData::Init() { 15 bool TestImageData::Init() {
16 image_data_interface_ = static_cast<const PPB_ImageData*>( 16 image_data_interface_ = static_cast<const PPB_ImageData*>(
17 pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE)); 17 pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE));
18 return !!image_data_interface_; 18 return !!image_data_interface_;
19 } 19 }
20 20
21 void TestImageData::RunTests(const std::string& filter) { 21 void TestImageData::RunTests(const std::string& filter) {
22 instance_->LogTest("InvalidFormat", TestInvalidFormat()); 22 RUN_TEST(InvalidFormat, filter);
23 instance_->LogTest("GetNativeFormat", TestGetNativeFormat()); 23 RUN_TEST(GetNativeFormat, filter);
24 instance_->LogTest("IsImageDataFormatSupported", TestFormatSupported()); 24 RUN_TEST(FormatSupported, filter);
25 instance_->LogTest("InvalidSize", TestInvalidSize()); 25 RUN_TEST(InvalidSize, filter);
26 instance_->LogTest("HugeSize", TestHugeSize()); 26 RUN_TEST(HugeSize, filter);
27 instance_->LogTest("InitToZero", TestInitToZero()); 27 RUN_TEST(InitToZero, filter);
28 instance_->LogTest("IsImageData", TestIsImageData()); 28 RUN_TEST(IsImageData, filter);
29 } 29 }
30 30
31 std::string TestImageData::TestInvalidFormat() { 31 std::string TestImageData::TestInvalidFormat() {
32 pp::ImageData a(instance_, static_cast<PP_ImageDataFormat>(1337), 32 pp::ImageData a(instance_, static_cast<PP_ImageDataFormat>(1337),
33 pp::Size(16, 16), true); 33 pp::Size(16, 16), true);
34 if (!a.is_null()) 34 if (!a.is_null())
35 return "Crazy image data format accepted"; 35 return "Crazy image data format accepted";
36 36
37 pp::ImageData b(instance_, static_cast<PP_ImageDataFormat>(-1), 37 pp::ImageData b(instance_, static_cast<PP_ImageDataFormat>(-1),
38 pp::Size(16, 16), true); 38 pp::Size(16, 16), true);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 pp::Graphics2D device(instance_, pp::Size(w, h), true); 174 pp::Graphics2D device(instance_, pp::Size(w, h), true);
175 if (device.is_null()) 175 if (device.is_null())
176 return "Couldn't create device context"; 176 return "Couldn't create device context";
177 if (image_data_interface_->IsImageData(device.pp_resource())) 177 if (image_data_interface_->IsImageData(device.pp_resource()))
178 return "Device context was reported as an image"; 178 return "Device context was reported as an image";
179 179
180 ASSERT_SUBTEST_SUCCESS(SubTestIsImageData(PP_IMAGEDATAFORMAT_BGRA_PREMUL)); 180 ASSERT_SUBTEST_SUCCESS(SubTestIsImageData(PP_IMAGEDATAFORMAT_BGRA_PREMUL));
181 ASSERT_SUBTEST_SUCCESS(SubTestIsImageData(PP_IMAGEDATAFORMAT_RGBA_PREMUL)); 181 ASSERT_SUBTEST_SUCCESS(SubTestIsImageData(PP_IMAGEDATAFORMAT_RGBA_PREMUL));
182 PASS(); 182 PASS();
183 } 183 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_case.cc ('k') | ppapi/tests/test_input_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698