| 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" |
| 11 #include "ppapi/c/pp_errors.h" | 11 #include "ppapi/c/pp_errors.h" |
| 12 #include "ppapi/c/ppb_graphics_2d.h" | 12 #include "ppapi/c/ppb_graphics_2d.h" |
| 13 #include "ppapi/cpp/completion_callback.h" | 13 #include "ppapi/cpp/completion_callback.h" |
| 14 #include "ppapi/cpp/graphics_2d.h" | 14 #include "ppapi/cpp/graphics_2d.h" |
| 15 #include "ppapi/cpp/image_data.h" | 15 #include "ppapi/cpp/image_data.h" |
| 16 #include "ppapi/cpp/instance.h" | 16 #include "ppapi/cpp/instance.h" |
| 17 #include "ppapi/cpp/module.h" | 17 #include "ppapi/cpp/module.h" |
| 18 #include "ppapi/cpp/rect.h" | 18 #include "ppapi/cpp/rect.h" |
| 19 #include "ppapi/tests/testing_instance.h" | 19 #include "ppapi/tests/testing_instance.h" |
| 20 | 20 |
| 21 REGISTER_TEST_CASE(Graphics2D); | 21 REGISTER_TEST_CASE(Graphics2D); |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 // A NOP flush callback for use in various tests. | 25 // A NOP flush callback for use in various tests. |
| 26 void FlushCallbackNOP(void* data, int32_t result) { | 26 void FlushCallbackNOP(void* data, int32_t result) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 void FlushCallbackQuitMessageLoop(void* data, int32_t result) { | 29 void FlushCallbackQuitMessageLoop(void* data, int32_t result) { |
| 30 reinterpret_cast<TestGraphics2D*>(data)->QuitMessageLoop(); | 30 static_cast<TestGraphics2D*>(data)->QuitMessageLoop(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 bool TestGraphics2D::Init() { | 35 bool TestGraphics2D::Init() { |
| 36 graphics_2d_interface_ = reinterpret_cast<PPB_Graphics2D const*>( | 36 graphics_2d_interface_ = static_cast<const PPB_Graphics2D*>( |
| 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_ = static_cast<const PPB_ImageData*>( |
| 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::RunTests(const std::string& filter) { | 44 void TestGraphics2D::RunTests(const std::string& filter) { |
| 45 RUN_TEST(InvalidResource, filter); | 45 RUN_TEST(InvalidResource, filter); |
| 46 RUN_TEST(InvalidSize, filter); | 46 RUN_TEST(InvalidSize, filter); |
| 47 RUN_TEST(Humongous, filter); | 47 RUN_TEST(Humongous, filter); |
| 48 RUN_TEST(InitToZero, filter); | 48 RUN_TEST(InitToZero, filter); |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 if (rv != PP_OK_COMPLETIONPENDING) | 621 if (rv != PP_OK_COMPLETIONPENDING) |
| 622 return "Second flush must fail asynchronously."; | 622 return "Second flush must fail asynchronously."; |
| 623 } else { | 623 } else { |
| 624 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) | 624 if (rv == PP_OK || rv == PP_OK_COMPLETIONPENDING) |
| 625 return "Second flush succeeded before callback ran."; | 625 return "Second flush succeeded before callback ran."; |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 | 628 |
| 629 PASS(); | 629 PASS(); |
| 630 } | 630 } |
| OLD | NEW |