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 #ifndef PPAPI_TESTS_TEST_GRAPHICS_2D_H_ | 5 #ifndef PPAPI_TESTS_TEST_GRAPHICS_2D_H_ |
6 #define PPAPI_TESTS_TEST_GRAPHICS_2D_H_ | 6 #define PPAPI_TESTS_TEST_GRAPHICS_2D_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 const pp::Rect& square, uint32_t square_color) const; | 59 const pp::Rect& square, uint32_t square_color) const; |
60 | 60 |
61 // Validates that the given device context is a single color with a square of | 61 // Validates that the given device context is a single color with a square of |
62 // another color inside it. | 62 // another color inside it. |
63 bool IsSquareInDC(const pp::Graphics2D& dc, uint32_t background_color, | 63 bool IsSquareInDC(const pp::Graphics2D& dc, uint32_t background_color, |
64 const pp::Rect& square, uint32_t square_color) const; | 64 const pp::Rect& square, uint32_t square_color) const; |
65 | 65 |
66 // Validates that the given device context is filled with the given color. | 66 // Validates that the given device context is filled with the given color. |
67 bool IsDCUniformColor(const pp::Graphics2D& dc, uint32_t color) const; | 67 bool IsDCUniformColor(const pp::Graphics2D& dc, uint32_t color) const; |
68 | 68 |
69 // Returns true if Graphics2D resource is created correctly. | |
70 bool ResourceHealthCheck(pp::Instance* instance, pp::Graphics2D* context); | |
71 bool ResourceHealthCheckForC(pp::Instance* instance, PP_Resource graphics_2d); | |
72 | |
73 // Issues a flush on the given device context and blocks until the flush | 69 // Issues a flush on the given device context and blocks until the flush |
74 // has issued its callback. Returns true on success. | 70 // has issued its callback. Returns an empty string on success or an error |
75 bool FlushAndWaitForDone(pp::Graphics2D* context); | 71 // message on failure. |
| 72 std::string FlushAndWaitForDone(pp::Graphics2D* context); |
76 | 73 |
77 // Creates an image and replaces the contents of the Graphics2D with the | 74 // Creates an image and replaces the contents of the Graphics2D with the |
78 // image, waiting for completion. This returns the resource ID of the image | 75 // image, waiting for completion. This returns the resource ID of the image |
79 // data we created. This image data will be released by the time the call | 76 // data we created. This image data will be released by the time the call |
80 // completes, but it can be used for comparisons later. | 77 // completes, but it can be used for comparisons later. |
81 // | 78 // |
82 // Returns 0 on failure. | 79 // Returns 0 on failure. |
83 PP_Resource ReplaceContentsAndReturnID(pp::Graphics2D* dc, | 80 PP_Resource ReplaceContentsAndReturnID(pp::Graphics2D* dc, |
84 const pp::Size& size); | 81 const pp::Size& size); |
85 | 82 |
(...skipping 14 matching lines...) Expand all Loading... |
100 std::string TestPaint(); | 97 std::string TestPaint(); |
101 std::string TestScroll(); | 98 std::string TestScroll(); |
102 std::string TestReplace(); | 99 std::string TestReplace(); |
103 std::string TestFlush(); | 100 std::string TestFlush(); |
104 std::string TestFlushOffscreenUpdate(); | 101 std::string TestFlushOffscreenUpdate(); |
105 std::string TestDev(); | 102 std::string TestDev(); |
106 std::string TestReplaceContentsCaching(); | 103 std::string TestReplaceContentsCaching(); |
107 std::string TestBindNull(); | 104 std::string TestBindNull(); |
108 | 105 |
109 // Used by the tests that access the C API directly. | 106 // Used by the tests that access the C API directly. |
110 const PPB_Graphics2D* graphics_2d_interface_; | 107 const PPB_Graphics2D_1_1* graphics_2d_interface_; |
111 const PPB_ImageData* image_data_interface_; | 108 const PPB_ImageData_1_0* image_data_interface_; |
112 | 109 |
113 // Used to indicate that DidChangeView has happened, in order to make plugin | 110 // Used to indicate that DidChangeView has happened, in order to make plugin |
114 // and ui synchronous. | 111 // and ui synchronous. |
115 bool is_view_changed_; | 112 bool is_view_changed_; |
116 | 113 |
117 // Set to true to request that the next invocation of DidChangeView should | 114 // Set to true to request that the next invocation of DidChangeView should |
118 // post a quit to the message loop. DidChangeView will also reset the flag so | 115 // post a quit to the message loop. DidChangeView will also reset the flag so |
119 // this will only happen once. | 116 // this will only happen once. |
120 bool post_quit_on_view_changed_; | 117 bool post_quit_on_view_changed_; |
121 }; | 118 }; |
122 | 119 |
123 #endif // PPAPI_TESTS_TEST_GRAPHICS_2D_H_ | 120 #endif // PPAPI_TESTS_TEST_GRAPHICS_2D_H_ |
OLD | NEW |