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