| OLD | NEW |
| 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 10 matching lines...) Expand all Loading... |
| 21 #include "ppapi/cpp/instance.h" | 21 #include "ppapi/cpp/instance.h" |
| 22 #include "ppapi/cpp/module.h" | 22 #include "ppapi/cpp/module.h" |
| 23 #include "ppapi/cpp/rect.h" | 23 #include "ppapi/cpp/rect.h" |
| 24 #include "ppapi/tests/test_utils.h" | 24 #include "ppapi/tests/test_utils.h" |
| 25 #include "ppapi/tests/testing_instance.h" | 25 #include "ppapi/tests/testing_instance.h" |
| 26 | 26 |
| 27 REGISTER_TEST_CASE(Graphics2D); | 27 REGISTER_TEST_CASE(Graphics2D); |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 // A NOP flush callback for use in various tests. | |
| 32 void FlushCallbackNOP(void* data, int32_t result) { | |
| 33 } | |
| 34 | |
| 35 void FlushCallbackQuitMessageLoop(void* data, int32_t result) { | |
| 36 static_cast<TestGraphics2D*>(data)->QuitMessageLoop(); | |
| 37 } | |
| 38 | |
| 39 bool CanFlushContext(pp::Instance* instance, pp::Graphics2D* context) { | 31 bool CanFlushContext(pp::Instance* instance, pp::Graphics2D* context) { |
| 40 TestCompletionCallback callback(instance->pp_instance()); | 32 TestCompletionCallback callback(instance->pp_instance()); |
| 41 callback.WaitForResult(context->Flush(callback.GetCallback())); | 33 callback.WaitForResult(context->Flush(callback.GetCallback())); |
| 42 return (callback.result() == PP_OK); | 34 return (callback.result() == PP_OK); |
| 43 } | 35 } |
| 44 | 36 |
| 45 bool CanFlushContextC(pp::Instance* instance, PP_Resource graphics_2d, | 37 bool CanFlushContextC(pp::Instance* instance, PP_Resource graphics_2d, |
| 46 const PPB_Graphics2D_1_1* graphics_2d_if) { | 38 const PPB_Graphics2D_1_1* graphics_2d_if) { |
| 47 TestCompletionCallback callback(instance->pp_instance()); | 39 TestCompletionCallback callback(instance->pp_instance()); |
| 48 callback.WaitForResult(graphics_2d_if->Flush( | 40 callback.WaitForResult(graphics_2d_if->Flush( |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 pp::Graphics2D dc(instance_, pp::Size(w, h), false); | 800 pp::Graphics2D dc(instance_, pp::Size(w, h), false); |
| 809 ASSERT_FALSE(dc.is_null()); | 801 ASSERT_FALSE(dc.is_null()); |
| 810 ASSERT_TRUE(instance_->BindGraphics(dc)); | 802 ASSERT_TRUE(instance_->BindGraphics(dc)); |
| 811 | 803 |
| 812 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D())); | 804 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics2D())); |
| 813 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D())); | 805 ASSERT_TRUE(instance_->BindGraphics(pp::Graphics3D())); |
| 814 | 806 |
| 815 PASS(); | 807 PASS(); |
| 816 } | 808 } |
| 817 | 809 |
| OLD | NEW |