diff options
author | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-05 14:45:44 +0000 |
---|---|---|
committer | dmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-05 14:45:44 +0000 |
commit | 6f2e3919c4709404d8d7b6742f9cd9989b799c98 (patch) | |
tree | 55a933f7e2988625f0f3ded5a562203c7e3921c9 /ppapi/tests | |
parent | 79ba2d8a26fe6c9b343c57fef57896a90baa3878 (diff) | |
download | chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.zip chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.gz chromium_src-6f2e3919c4709404d8d7b6742f9cd9989b799c98.tar.bz2 |
Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on Windows). This includes changing bool to PP_Bool and adding a PP_INLINE macro.
TEST=tests/test_c_includes.c
BUG=59791,53451
The first patch set is a straight copy of http://codereview.chromium.org/4019010/show which got LGTMed when PPAPI was in its own repo, but had to be rolled back in order to include chrome changes.
IMPORTANT: This change will break plugin implementations that use the C interface, and might break others as well.
Review URL: http://codereview.chromium.org/4310002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65200 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_c_includes.c | 74 | ||||
-rw-r--r-- | ppapi/tests/test_graphics_2d.cc | 18 | ||||
-rw-r--r-- | ppapi/tests/test_image_data.cc | 5 | ||||
-rw-r--r-- | ppapi/tests/test_var_deprecated.cc | 2 |
4 files changed, 87 insertions, 12 deletions
diff --git a/ppapi/tests/test_c_includes.c b/ppapi/tests/test_c_includes.c new file mode 100644 index 0000000..e17671f --- /dev/null +++ b/ppapi/tests/test_c_includes.c @@ -0,0 +1,74 @@ +/* Copyright (c) 2010 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + + * This test simply includes all the C headers to ensure they compile with a C + compiler. If it compiles, it passes. + */ +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/c/pp_input_event.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_point.h" +#include "ppapi/c/pp_rect.h" +#include "ppapi/c/pp_resource.h" +#include "ppapi/c/pp_size.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_time.h" +#include "ppapi/c/pp_var.h" +#include "ppapi/c/ppb.h" +#include "ppapi/c/ppb_class.h" +#include "ppapi/c/ppb_core.h" +#include "ppapi/c/ppb_graphics_2d.h" +#include "ppapi/c/ppb_image_data.h" +#include "ppapi/c/ppb_instance.h" +#include "ppapi/c/ppb_var.h" +#include "ppapi/c/ppp.h" +#include "ppapi/c/ppp_instance.h" +#include "ppapi/c/dev/deprecated_bool.h" +#include "ppapi/c/dev/pp_cursor_type_dev.h" +#include "ppapi/c/dev/pp_file_info_dev.h" +#include "ppapi/c/dev/pp_video_dev.h" +#include "ppapi/c/dev/ppb_audio_config_dev.h" +#include "ppapi/c/dev/ppb_audio_dev.h" +#include "ppapi/c/dev/ppb_audio_trusted_dev.h" +#include "ppapi/c/dev/ppb_buffer_dev.h" +#include "ppapi/c/dev/ppb_char_set_dev.h" +#include "ppapi/c/dev/ppb_cursor_control_dev.h" +#include "ppapi/c/dev/ppb_directory_reader_dev.h" +#include "ppapi/c/dev/ppb_file_chooser_dev.h" +#include "ppapi/c/dev/ppb_file_io_dev.h" +#include "ppapi/c/dev/ppb_file_io_trusted_dev.h" +#include "ppapi/c/dev/ppb_file_ref_dev.h" +#include "ppapi/c/dev/ppb_file_system_dev.h" +#include "ppapi/c/dev/ppb_find_dev.h" +#include "ppapi/c/dev/ppb_font_dev.h" +#include "ppapi/c/dev/ppb_fullscreen_dev.h" +#include "ppapi/c/dev/ppb_graphics_3d_dev.h" +#include "ppapi/c/dev/ppb_opengles_dev.h" +#include "ppapi/c/dev/ppb_scrollbar_dev.h" +#include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/dev/ppb_transport_dev.h" +#include "ppapi/c/dev/ppb_url_loader_dev.h" +#include "ppapi/c/dev/ppb_url_loader_trusted_dev.h" +#include "ppapi/c/dev/ppb_url_request_info_dev.h" +#include "ppapi/c/dev/ppb_url_response_info_dev.h" +#include "ppapi/c/dev/ppb_url_util_dev.h" +#include "ppapi/c/dev/ppb_var_deprecated.h" +#include "ppapi/c/dev/ppb_video_decoder_dev.h" +#include "ppapi/c/dev/ppb_widget_dev.h" +#include "ppapi/c/dev/ppb_zoom_dev.h" +#include "ppapi/c/dev/ppp_class_deprecated.h" +#include "ppapi/c/dev/ppp_cursor_control_dev.h" +#include "ppapi/c/dev/ppp_find_dev.h" +#include "ppapi/c/dev/ppp_graphics_3d_dev.h" +#include "ppapi/c/dev/ppp_printing_dev.h" +#include "ppapi/c/dev/ppp_scrollbar_dev.h" +#include "ppapi/c/dev/ppp_selection_dev.h" +#include "ppapi/c/dev/ppp_widget_dev.h" +#include "ppapi/c/dev/ppp_zoom_dev.h" +#include "ppapi/c/trusted/ppb_image_data_trusted.h" + diff --git a/ppapi/tests/test_graphics_2d.cc b/ppapi/tests/test_graphics_2d.cc index 34b9945..1ba8f7f 100644 --- a/ppapi/tests/test_graphics_2d.cc +++ b/ppapi/tests/test_graphics_2d.cc @@ -9,6 +9,7 @@ #include "ppapi/c/dev/ppb_testing_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_graphics_2d.h" +#include "ppapi/cpp/common.h" #include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/graphics_2d.h" #include "ppapi/cpp/image_data.h" @@ -68,9 +69,10 @@ void TestGraphics2D::QuitMessageLoop() { bool TestGraphics2D::ReadImageData(const pp::Graphics2D& dc, pp::ImageData* image, const pp::Point& top_left) const { - return testing_interface_->ReadImageData(dc.pp_resource(), - image->pp_resource(), - &top_left.pp_point()); + return pp::PPBoolToBool(testing_interface_->ReadImageData( + dc.pp_resource(), + image->pp_resource(), + &top_left.pp_point())); } bool TestGraphics2D::IsDCUniformColor(const pp::Graphics2D& dc, @@ -181,7 +183,7 @@ std::string TestGraphics2D::TestInvalidResource() { // Describe. PP_Size size; - bool opaque; + PP_Bool opaque; graphics_2d_interface_->Describe(image.pp_resource(), &size, &opaque); graphics_2d_interface_->Describe(null_context.pp_resource(), &size, &opaque); @@ -248,12 +250,12 @@ std::string TestGraphics2D::TestInvalidSize() { size.width = 16; size.height = -16; ASSERT_FALSE(!!graphics_2d_interface_->Create( - pp::Module::Get()->pp_module(), &size, false)); + pp::Module::Get()->pp_module(), &size, PP_FALSE)); size.width = -16; size.height = 16; ASSERT_FALSE(!!graphics_2d_interface_->Create( - pp::Module::Get()->pp_module(), &size, false)); + pp::Module::Get()->pp_module(), &size, PP_FALSE)); return ""; } @@ -296,11 +298,11 @@ std::string TestGraphics2D::TestDescribe() { PP_Size size; size.width = -1; size.height = -1; - bool is_always_opaque = true; + PP_Bool is_always_opaque = PP_TRUE; if (!graphics_2d_interface_->Describe(dc.pp_resource(), &size, &is_always_opaque)) return "Describe failed"; - if (size.width != w || size.height != h || is_always_opaque != false) + if (size.width != w || size.height != h || is_always_opaque != PP_FALSE) return "Mismatch of data."; return ""; diff --git a/ppapi/tests/test_image_data.cc b/ppapi/tests/test_image_data.cc index 6b918f4..6300264 100644 --- a/ppapi/tests/test_image_data.cc +++ b/ppapi/tests/test_image_data.cc @@ -61,7 +61,7 @@ std::string TestImageData::TestInvalidSize() { PP_Resource rsrc = image_data_interface_->Create( pp::Module::Get()->pp_module(), PP_IMAGEDATAFORMAT_BGRA_PREMUL, - &negative_height, true); + &negative_height, PP_TRUE); if (rsrc) return "Negative height accepted"; @@ -71,7 +71,7 @@ std::string TestImageData::TestInvalidSize() { rsrc = image_data_interface_->Create( pp::Module::Get()->pp_module(), PP_IMAGEDATAFORMAT_BGRA_PREMUL, - &negative_width, true); + &negative_width, PP_TRUE); if (rsrc) return "Negative width accepted"; @@ -137,4 +137,3 @@ std::string TestImageData::TestIsImageData() { return ""; } - diff --git a/ppapi/tests/test_var_deprecated.cc b/ppapi/tests/test_var_deprecated.cc index 084afaf..b4bdee9 100644 --- a/ppapi/tests/test_var_deprecated.cc +++ b/ppapi/tests/test_var_deprecated.cc @@ -219,7 +219,7 @@ std::string TestVarDeprecated::TestVarToUtf8ForWrongType() { length = kInvalidLength; result = NULL; - result = var_interface_->VarToUtf8(PP_MakeBool(true), &length); + result = var_interface_->VarToUtf8(PP_MakeBool(PP_TRUE), &length); if (length != 0) { return "Expected 0 on string conversion from Bool var."; } |