| OLD | NEW |
| 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_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 "ppapi/c/dev/ppb_testing_dev.h" | 10 #include "ppapi/c/dev/ppb_testing_dev.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 bool TestGraphics2D::Init() { | 35 bool TestGraphics2D::Init() { |
| 36 graphics_2d_interface_ = reinterpret_cast<PPB_Graphics2D const*>( | 36 graphics_2d_interface_ = reinterpret_cast<PPB_Graphics2D const*>( |
| 37 pp::Module::Get()->GetBrowserInterface(PPB_GRAPHICS_2D_INTERFACE)); | 37 pp::Module::Get()->GetBrowserInterface(PPB_GRAPHICS_2D_INTERFACE)); |
| 38 image_data_interface_ = reinterpret_cast<PPB_ImageData const*>( | 38 image_data_interface_ = reinterpret_cast<PPB_ImageData const*>( |
| 39 pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE)); | 39 pp::Module::Get()->GetBrowserInterface(PPB_IMAGEDATA_INTERFACE)); |
| 40 return graphics_2d_interface_ && image_data_interface_ && | 40 return graphics_2d_interface_ && image_data_interface_ && |
| 41 InitTestingInterface(); | 41 InitTestingInterface(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void TestGraphics2D::RunTest() { | 44 void TestGraphics2D::RunTests(const std::string& filter) { |
| 45 RUN_TEST(InvalidResource); | 45 RUN_TEST(InvalidResource, filter); |
| 46 RUN_TEST(InvalidSize); | 46 RUN_TEST(InvalidSize, filter); |
| 47 RUN_TEST(Humongous); | 47 RUN_TEST(Humongous, filter); |
| 48 RUN_TEST(InitToZero); | 48 RUN_TEST(InitToZero, filter); |
| 49 RUN_TEST(Describe); | 49 RUN_TEST(Describe, filter); |
| 50 RUN_TEST_FORCEASYNC_AND_NOT(Paint); | 50 RUN_TEST_FORCEASYNC_AND_NOT(Paint, filter); |
| 51 // RUN_TEST_FORCEASYNC_AND_NOT(Scroll); // TODO(brettw) implement. | 51 // RUN_TEST_FORCEASYNC_AND_NOT(Scroll); // TODO(brettw, filter) implement. |
| 52 RUN_TEST_FORCEASYNC_AND_NOT(Replace); | 52 RUN_TEST_FORCEASYNC_AND_NOT(Replace, filter); |
| 53 RUN_TEST_FORCEASYNC_AND_NOT(Flush); | 53 RUN_TEST_FORCEASYNC_AND_NOT(Flush, filter); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void TestGraphics2D::QuitMessageLoop() { | 56 void TestGraphics2D::QuitMessageLoop() { |
| 57 testing_interface_->QuitMessageLoop(instance_->pp_instance()); | 57 testing_interface_->QuitMessageLoop(instance_->pp_instance()); |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool TestGraphics2D::ReadImageData(const pp::Graphics2D& dc, | 60 bool TestGraphics2D::ReadImageData(const pp::Graphics2D& dc, |
| 61 pp::ImageData* image, | 61 pp::ImageData* image, |
| 62 const pp::Point& top_left) const { | 62 const pp::Point& top_left) const { |
| 63 return PP_ToBool(testing_interface_->ReadImageData( | 63 return PP_ToBool(testing_interface_->ReadImageData( |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (rv != PP_OK_COMPLETIONPENDING) | 546 if (rv != PP_OK_COMPLETIONPENDING) |
| 547 return "Second flush must fail asynchronously."; | 547 return "Second flush must fail asynchronously."; |
| 548 } else { | 548 } else { |
| 549 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) | 549 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) |
| 550 return "Second flush succeeded before callback ran."; | 550 return "Second flush succeeded before callback ran."; |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 | 553 |
| 554 PASS(); | 554 PASS(); |
| 555 } | 555 } |
| OLD | NEW |