OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 pp::Size(0, 16), true); | 54 pp::Size(0, 16), true); |
55 if (!zero_width.is_null()) | 55 if (!zero_width.is_null()) |
56 return "Zero width accepted"; | 56 return "Zero width accepted"; |
57 | 57 |
58 PP_Size negative_height; | 58 PP_Size negative_height; |
59 negative_height.width = 16; | 59 negative_height.width = 16; |
60 negative_height.height = -2; | 60 negative_height.height = -2; |
61 PP_Resource rsrc = image_data_interface_->Create( | 61 PP_Resource rsrc = image_data_interface_->Create( |
62 pp::Module::Get()->pp_module(), | 62 pp::Module::Get()->pp_module(), |
63 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 63 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
64 &negative_height, true); | 64 &negative_height, PP_TRUE); |
65 if (rsrc) | 65 if (rsrc) |
66 return "Negative height accepted"; | 66 return "Negative height accepted"; |
67 | 67 |
68 PP_Size negative_width; | 68 PP_Size negative_width; |
69 negative_width.width = -2; | 69 negative_width.width = -2; |
70 negative_width.height = 16; | 70 negative_width.height = 16; |
71 rsrc = image_data_interface_->Create( | 71 rsrc = image_data_interface_->Create( |
72 pp::Module::Get()->pp_module(), | 72 pp::Module::Get()->pp_module(), |
73 PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 73 PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
74 &negative_width, true); | 74 &negative_width, PP_TRUE); |
75 if (rsrc) | 75 if (rsrc) |
76 return "Negative width accepted"; | 76 return "Negative width accepted"; |
77 | 77 |
78 return ""; | 78 return ""; |
79 } | 79 } |
80 | 80 |
81 std::string TestImageData::TestHugeSize() { | 81 std::string TestImageData::TestHugeSize() { |
82 pp::ImageData huge_size(PP_IMAGEDATAFORMAT_BGRA_PREMUL, | 82 pp::ImageData huge_size(PP_IMAGEDATAFORMAT_BGRA_PREMUL, |
83 pp::Size(100000000, 100000000), true); | 83 pp::Size(100000000, 100000000), true); |
84 if (!huge_size.is_null()) | 84 if (!huge_size.is_null()) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // Make a valid image resource. | 131 // Make a valid image resource. |
132 pp::ImageData img(PP_IMAGEDATAFORMAT_BGRA_PREMUL, pp::Size(w, h), true); | 132 pp::ImageData img(PP_IMAGEDATAFORMAT_BGRA_PREMUL, pp::Size(w, h), true); |
133 if (img.is_null()) | 133 if (img.is_null()) |
134 return "Couldn't create image data"; | 134 return "Couldn't create image data"; |
135 if (!image_data_interface_->IsImageData(img.pp_resource())) | 135 if (!image_data_interface_->IsImageData(img.pp_resource())) |
136 return "Image data should be identified as an image"; | 136 return "Image data should be identified as an image"; |
137 | 137 |
138 return ""; | 138 return ""; |
139 } | 139 } |
140 | |
OLD | NEW |