This source file includes following definitions.
- TestIsFullFrame
- TestBindGraphics
- SetupTests
- SetupPluginInterfaces
#include "native_client/src/shared/platform/nacl_check.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/ppb_image_data.h"
#include "ppapi/c/ppb_instance.h"
#include "ppapi/c/ppb_graphics_2d.h"
#include "ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h"
#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
namespace {
void TestIsFullFrame() {
PP_Bool full_frame = PPBInstance()->IsFullFrame(pp_instance());
EXPECT(full_frame == PP_FALSE);
full_frame = PPBInstance()->IsFullFrame(kInvalidInstance);
EXPECT(full_frame == PP_FALSE);
TEST_PASSED;
}
void TestBindGraphics() {
PP_Size size = PP_MakeSize(100, 100);
PP_Resource graphics1 = PPBGraphics2D()->Create(
pp_instance(), &size, PP_TRUE);
PP_Resource graphics2 = PPBGraphics2D()->Create(
pp_instance(), &size, PP_TRUE);
EXPECT(graphics1 != kInvalidResource);
EXPECT(graphics2 != kInvalidResource);
PP_Bool ret = PPBInstance()->BindGraphics(pp_instance(), graphics1);
EXPECT(ret == PP_TRUE);
ret = PPBInstance()->BindGraphics(pp_instance(), graphics2);
EXPECT(ret == PP_TRUE);
ret = PPBInstance()->BindGraphics(kInvalidInstance, graphics1);
EXPECT(ret == PP_FALSE);
ret = PPBInstance()->BindGraphics(kInvalidInstance, graphics2);
EXPECT(ret == PP_FALSE);
ret = PPBInstance()->BindGraphics(pp_instance(), kInvalidResource);
EXPECT(ret == PP_TRUE);
PP_Resource image_data = PPBImageData()->Create(
pp_instance(), PP_IMAGEDATAFORMAT_RGBA_PREMUL, &size, PP_FALSE);
EXPECT(image_data != kInvalidResource);
ret = PPBInstance()->BindGraphics(pp_instance(), image_data);
EXPECT(ret == PP_FALSE);
TEST_PASSED;
}
}
void SetupTests() {
RegisterTest("TestIsFullFrame", TestIsFullFrame);
RegisterTest("TestBindGraphics", TestBindGraphics);
}
void SetupPluginInterfaces() {
}