summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 01:18:11 +0000
committerncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-07 01:18:11 +0000
commit59132d4366e2d2b49c1cb4a8fee45760476f7d9f (patch)
tree3f276fc9c2c5fddfb1b99d64b5dce57eaec4baa0 /ppapi
parent26fffd8a3f2ffd72c737dfadd841b2f1c3846151 (diff)
downloadchromium_src-59132d4366e2d2b49c1cb4a8fee45760476f7d9f.zip
chromium_src-59132d4366e2d2b49c1cb4a8fee45760476f7d9f.tar.gz
chromium_src-59132d4366e2d2b49c1cb4a8fee45760476f7d9f.tar.bz2
Remove even more redundant PPAPI tests from nacl_integration.
BUG= http://code.google.com/p/chromium/issues/detail?id=154400 Review URL: https://chromiumcodereview.appspot.com/11293122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/native_client/ppapi_scons_files.py3
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_file_system/nacl.scons38
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc208
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.html29
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.js53
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_image_data/nacl.scons41
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.cc365
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.html81
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppp_input_event/nacl.scons40
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.cc214
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.html32
-rw-r--r--ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.js88
12 files changed, 0 insertions, 1192 deletions
diff --git a/ppapi/native_client/ppapi_scons_files.py b/ppapi/native_client/ppapi_scons_files.py
index 175f8f9..15775dee 100644
--- a/ppapi/native_client/ppapi_scons_files.py
+++ b/ppapi/native_client/ppapi_scons_files.py
@@ -25,10 +25,7 @@ nonvariant_test_scons_files = [
'tests/ppapi_browser/crash/nacl.scons',
'tests/ppapi_browser/extension_mime_handler/nacl.scons',
'tests/ppapi_browser/manifest/nacl.scons',
- 'tests/ppapi_browser/ppb_file_system/nacl.scons',
- 'tests/ppapi_browser/ppb_image_data/nacl.scons',
'tests/ppapi_browser/ppb_instance/nacl.scons',
- 'tests/ppapi_browser/ppp_input_event/nacl.scons',
'tests/ppapi_browser/ppp_instance/nacl.scons',
'tests/ppapi_test_lib/nacl.scons',
]
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/nacl.scons b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/nacl.scons
deleted file mode 100644
index b0de2a5..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/nacl.scons
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2012 The Native Client 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 uses ppapi_test_lib.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/' +
- 'ppb_file_system')
-
-nexe = env.ProgramNameForNmf('ppapi_ppb_file_system')
-env.Alias('ppapi_ppb_file_system${PROGSUFFIX}',
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-
-env.ComponentProgram(nexe,
- ['ppapi_ppb_file_system.cc'],
- EXTRA_LIBS=['ppapi',
- 'ppapi_test_lib',
- 'platform',
- 'pthread',
- 'gio'])
-
-env.Publish(nexe, 'run',
- ['ppapi_ppb_file_system.html',
- 'ppapi_ppb_file_system.js'])
-
-node = env.PPAPIBrowserTester('ppapi_ppb_file_system_browser_test.out',
- url='ppapi_ppb_file_system.html',
- nmf_names=['ppapi_ppb_file_system'],
- files=env.ExtractPublishedFiles(nexe))
-
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_ppapi_ppb_file_system_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc
deleted file mode 100644
index 8490f5f..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.cc
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
-#include "native_client/tests/ppapi_test_lib/test_interface.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/ppb_file_system.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "ppapi/c/pp_errors.h"
-
-namespace {
-
-struct OpenCallbackData {
- explicit OpenCallbackData(PP_Resource file_system)
- : file_system(file_system) {}
-
- PP_Resource file_system;
-};
-
-void OpenFailCallback(void* data, int32_t result) {
- EXPECT(result == PP_ERROR_NOACCESS);
- OpenCallbackData* callback_data = reinterpret_cast<OpenCallbackData*>(data);
- PPBCore()->ReleaseResource(callback_data->file_system);
- delete callback_data;
-}
-
-void OpenCallback(void* data, int32_t result) {
- EXPECT(result == PP_OK);
- OpenCallbackData* callback_data = reinterpret_cast<OpenCallbackData*>(data);
- PPBCore()->ReleaseResource(callback_data->file_system);
- delete callback_data;
-}
-
-const PP_FileSystemType kFileSystemTypes[] = {
- PP_FILESYSTEMTYPE_EXTERNAL,
- PP_FILESYSTEMTYPE_LOCALPERSISTENT,
- PP_FILESYSTEMTYPE_LOCALTEMPORARY
-};
-
-const size_t kNumFileSystemTypes =
- sizeof(kFileSystemTypes) / sizeof(kFileSystemTypes[0]);
-
-void TestCreate() {
- PP_Resource file_system = kInvalidResource;
- const PPB_FileSystem* ppb_file_system = PPBFileSystem();
- // Test to see if PPB_FileSystem::Create returns PP_Resource value of 0
- // if the instance parameter is invalid.
- file_system = ppb_file_system->Create(kInvalidInstance,
- PP_FILESYSTEMTYPE_EXTERNAL);
- EXPECT(file_system == kInvalidResource);
- file_system = ppb_file_system->Create(kInvalidInstance,
- PP_FILESYSTEMTYPE_LOCALPERSISTENT);
- EXPECT(file_system == kInvalidResource);
- file_system = ppb_file_system->Create(kInvalidInstance,
- PP_FILESYSTEMTYPE_LOCALTEMPORARY);
- EXPECT(file_system == kInvalidResource);
-
- // Test for failure when an invalid file system type is requested.
- file_system = ppb_file_system->Create(pp_instance(),
- PP_FILESYSTEMTYPE_INVALID);
- EXPECT(file_system == kInvalidResource);
-
- // Test to see if PPB_FileSystem::Create returns a valid PP_Resource
- // value when given a valid PP_Instance value parameter. Test for all
- // three file system types PPB_FileSystem supports.
- for (size_t i = 0; i < kNumFileSystemTypes; ++i) {
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- EXPECT(file_system != kInvalidResource);
- PPBCore()->ReleaseResource(file_system);
- }
- TEST_PASSED;
-}
-
-void TestIsFileSystem() {
- const PPB_Core* ppb_core = PPBCore();
- const PPB_FileSystem* ppb_file_system = PPBFileSystem();
- PP_Resource file_system = kInvalidResource;
- PP_Bool is_file_system = PP_FALSE;
-
- // Test fail for invalid resource.
- EXPECT(ppb_file_system->IsFileSystem(kInvalidResource) != PP_TRUE);
-
- // Test pass for the different valid system types, and test fail against a
- // resource that has been released.
- for (size_t i = 0; i < kNumFileSystemTypes; ++i) {
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- CHECK(file_system != kInvalidResource);
-
- is_file_system = ppb_file_system->IsFileSystem(file_system);
- ppb_core->ReleaseResource(file_system);
-
- EXPECT(is_file_system == PP_TRUE);
-
- is_file_system = ppb_file_system->IsFileSystem(file_system);
- EXPECT(is_file_system == PP_FALSE);
- }
-
- // Test fail against a non-filesystem resource.
- PP_Resource url_request_info = PPBURLRequestInfo()->Create(pp_instance());
- CHECK(url_request_info != kInvalidResource);
- is_file_system = ppb_file_system->IsFileSystem(url_request_info);
- ppb_core->ReleaseResource(url_request_info);
- EXPECT(is_file_system == PP_FALSE);
-
- TEST_PASSED;
-}
-
-void TestOpen() {
- const PPB_FileSystem* ppb_file_system = PPBFileSystem();
- static PP_Resource file_system = kInvalidResource;
- PP_CompletionCallback nop_callback =
- MakeTestableCompletionCallback("NopCallback", OpenCallback);
- int32_t pp_error = PP_ERROR_FAILED;
- int64_t kSize = 1024; // Dummy value.
-
- // Test to make sure opening an invalid file system fails.
- pp_error = ppb_file_system->Open(kInvalidResource, kSize, nop_callback);
- EXPECT(pp_error == PP_ERROR_BADRESOURCE);
-
- // Test that external storage fails with permission error.
- file_system = ppb_file_system->Create(pp_instance(),
- PP_FILESYSTEMTYPE_EXTERNAL);
- OpenCallbackData* callback_data_ext = new OpenCallbackData(file_system);
- PP_CompletionCallback open_fail_callback = MakeTestableCompletionCallback(
- "OpenCallback", OpenFailCallback, callback_data_ext);
- pp_error = ppb_file_system->Open(file_system, kSize, open_fail_callback);
- EXPECT(pp_error == PP_OK_COMPLETIONPENDING);
-
- // Test local temporary and local persistant file systems.
- for (size_t i = 1; i < kNumFileSystemTypes; ++i) {
-#ifdef __native_client__
- // Test fail for blocking open.
- //
- // Only conduct this test with nexe. Trusted ppapi plugin does not work
- // with synchronous Open call.
- // See http://code.google.com/p/chromium/issues/detail?id=78449
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- pp_error = ppb_file_system->Open(file_system, kSize,
- PP_BlockUntilComplete());
- PPBCore()->ReleaseResource(file_system);
- EXPECT(pp_error == PP_ERROR_BLOCKS_MAIN_THREAD);
-#endif
-
- // Test success for asynchronous open.
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- OpenCallbackData* callback_data = new OpenCallbackData(file_system);
- PP_CompletionCallback open_callback = MakeTestableCompletionCallback(
- "OpenCallback", OpenCallback, callback_data);
- pp_error = ppb_file_system->Open(file_system, kSize, open_callback);
- EXPECT(pp_error == PP_OK_COMPLETIONPENDING);
-
- // Test fail for multiple opens.
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- callback_data = new OpenCallbackData(file_system);
- open_callback = MakeTestableCompletionCallback(
- "OpenCallback", OpenCallback, callback_data);
- pp_error = ppb_file_system->Open(file_system, kSize, open_callback);
- CHECK(pp_error == PP_OK_COMPLETIONPENDING); // Previously tested.
- pp_error = ppb_file_system->Open(file_system, kSize, nop_callback);
- EXPECT(pp_error == PP_ERROR_INPROGRESS);
- }
- TEST_PASSED;
-}
-
-void TestGetType() {
- const PPB_Core* ppb_core = PPBCore();
- const PPB_FileSystem* ppb_file_system = PPBFileSystem();
- PP_Resource file_system = kInvalidResource;
- PP_FileSystemType type = PP_FILESYSTEMTYPE_INVALID;
-
- // Test for invalid resource.
- EXPECT(PP_FILESYSTEMTYPE_INVALID == ppb_file_system->GetType(0));
-
- // Test pass for the different valid system types.
- for (size_t i = 0; i < kNumFileSystemTypes; ++i) {
- file_system = ppb_file_system->Create(pp_instance(), kFileSystemTypes[i]);
- CHECK(file_system != kInvalidResource);
-
- type = ppb_file_system->GetType(file_system);
- ppb_core->ReleaseResource(file_system);
-
- EXPECT(type == kFileSystemTypes[i]);
- }
-
- // Test fail against a non-filesystem resource.
- PP_Resource url_request_info = PPBURLRequestInfo()->Create(pp_instance());
- CHECK(url_request_info != kInvalidResource);
- type = ppb_file_system->GetType(url_request_info);
- ppb_core->ReleaseResource(url_request_info);
- EXPECT(type == PP_FILESYSTEMTYPE_INVALID);
-
- TEST_PASSED;
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("TestCreate", TestCreate);
- RegisterTest("TestIsFileSystem", TestIsFileSystem);
- RegisterTest("TestOpen", TestOpen);
- RegisterTest("TestGetType", TestGetType);
-}
-
-void SetupPluginInterfaces() {
- /* No PPP interface to test. */
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.html b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.html
deleted file mode 100644
index 6fd53b7..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <!-- Copyright 2011 Google Inc. All rights reserved. -->
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
- <META HTTP-EQUIV="Expires" CONTENT="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <script type="text/javascript" src="ppapi_ppb_file_system.js"></script>
- <title>PPAPI PPB_FileSytem_Dev Test</title>
- </head>
- <body>
- <h1>PPAPI PPB_FileSystem_Dev Test</h1>
-
- <embed type="application/x-nacl" id="test_nexe"
- name="nacl_module"
- src="ppapi_ppb_file_system.nmf"
- width="0" height="0" />
-
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- setupTests(tester, $('test_nexe'));
- tester.waitFor($('test_nexe'));
- tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.js b/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.js
deleted file mode 100644
index cd1e91e..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_file_system/ppapi_ppb_file_system.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2011 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.
-
-function setupTests(tester, plugin) {
- tester.addAsyncTest('TestCreate', function(status) {
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- status.assertEqual(message.data, 'TestCreate:PASSED');
- status.pass();
- });
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestCreate");
- });
- tester.addAsyncTest('TestIsFileSystem', function(status) {
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- status.assertEqual(message.data, 'TestIsFileSystem:PASSED');
- status.pass();
- });
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestIsFileSystem");
- });
- tester.addAsyncTest('TestGetType', function(status) {
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- status.assertEqual(message.data, 'TestGetType:PASSED');
- status.pass();
- });
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestGetType");
- });
- tester.addAsyncTest('TestOpen', function(status) {
- var gotPassed = false;
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- if (!gotPassed) {
- status.assertEqual(message.data, 'TestOpen:PASSED');
- gotPassed = true;
- plugin.addEventListener("message", messageListener, false);
- } else {
- status.assertEqual(message.data, 'OpenCallback');
- status.pass();
- }
- });
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestOpen");
- });
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/nacl.scons b/ppapi/native_client/tests/ppapi_browser/ppb_image_data/nacl.scons
deleted file mode 100644
index a79152c..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/nacl.scons
+++ /dev/null
@@ -1,41 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2012 The Native Client 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 uses ppapi_test_lib.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/' +
- 'ppb_image_data')
-
-nexe = env.ProgramNameForNmf('ppapi_ppb_image_data')
-env.Alias('ppapi_ppb_image_data${PROGSUFFIX}',
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-
-env.ComponentProgram(
- nexe,
- ['ppapi_ppb_image_data.cc'],
- EXTRA_LIBS=['ppapi',
- 'ppapi_test_lib',
- 'platform', # for CHECK
- 'pthread',
- 'gio',
- ])
-
-env.Publish(nexe, 'run',
- [ 'ppapi_ppb_image_data.html',
- env.File('${SCONSTRUCT_DIR}/tools/browser_tester/'
- 'browserdata/nacltest.js') ])
-
-node = env.PPAPIBrowserTester('ppapi_ppb_image_data_browser_test.out',
- url='ppapi_ppb_image_data.html',
- nmf_names=['ppapi_ppb_image_data'],
- files=env.ExtractPublishedFiles(nexe))
-
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_ppapi_ppb_image_data_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.cc b/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.cc
deleted file mode 100644
index 870d2e0..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.cc
+++ /dev/null
@@ -1,365 +0,0 @@
-// Copyright (c) 2012 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.
-//
-// Test cases for PPB_ImageData functions.
-//
-// TODO(polina): use PPB_Testing for additional automatic validation.
-
-#include <string.h>
-
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
-#include "native_client/tests/ppapi_test_lib/test_interface.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_point.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/c/pp_size.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_url_loader.h"
-
-namespace {
-
-const int kPixelSizeInBytes = 4;
-const PP_Size kOnePixelImageSize = PP_MakeSize(1, 1);
-const PP_Size kSmallImageSize = PP_MakeSize(30, 30);
-const PP_Size kLargeImageSize = PP_MakeSize(2048, 2048);
-const PP_Size kValidImageSize[] = {
- kOnePixelImageSize,
- kSmallImageSize,
- kLargeImageSize
-};
-const int kNumValidImages = sizeof(kValidImageSize) / sizeof(PP_Size);
-const PP_Size kInvalidImageSize[] = {
- PP_MakeSize(100000000, 100000000),
- PP_MakeSize(-100000000, 100000000),
- PP_MakeSize(-100, 100000000),
- PP_MakeSize(100, -100000000),
- PP_MakeSize(-100, 100),
- PP_MakeSize(-100, -100),
- PP_MakeSize(0, 0),
- PP_MakeSize(0, 100),
- PP_MakeSize(100, 0)
-};
-const int kNumInvalidImages = sizeof(kInvalidImageSize) / sizeof(PP_Size);
-const int kManyResources = 100;
-const int kManyLargeResources = 500;
-
-union BogusFormat {
- int bogus;
- PP_ImageDataFormat format;
-};
-
-// Collection of small images.
-PP_Resource image_data[kManyResources];
-
-bool IsEqualSize(PP_Size size1, PP_Size size2) {
- return (size1.width == size2.width && size1.height == size2.height);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Test Cases
-////////////////////////////////////////////////////////////////////////////////
-
-// Tests PPB_ImageData::GetNativeImageDataFormat().
-void TestGetNativeImageDataFormat() {
- bool test_passed = false;
- PP_ImageDataFormat format;
- // TODO(nfullagar): If new formats are added after this test is written,
- // then the switch statement below will need to be updated, and additional
- // testing will need to be done in the other test cases below.
- // Also, new formats could introduce new pixel sizeis (in bytes), which
- // could affect some of the stride checks.
- format = PPBImageData()->GetNativeImageDataFormat();
- switch (format) {
- case PP_IMAGEDATAFORMAT_BGRA_PREMUL:
- case PP_IMAGEDATAFORMAT_RGBA_PREMUL:
- test_passed = true;
- }
- EXPECT(test_passed);
- TEST_PASSED;
-}
-
-// Tests PPB_ImageData::IsImageDataFormatSupported().
-void TestIsImageDataFormatSupported() {
- PP_ImageDataFormat format;
- BogusFormat bogus;
- format = PPBImageData()->GetNativeImageDataFormat();
- // EXPECT the format recommended by the browser is supported.
- EXPECT(PP_TRUE == PPBImageData()->IsImageDataFormatSupported(format));
- // Invoke with known formats, should not crash.
- PPBImageData()->IsImageDataFormatSupported(PP_IMAGEDATAFORMAT_BGRA_PREMUL);
- PPBImageData()->IsImageDataFormatSupported(PP_IMAGEDATAFORMAT_RGBA_PREMUL);
- // Make up invalid enums and verify they are not supported.
- bogus.bogus = -1;
- EXPECT(PP_FALSE == PPBImageData()->
- IsImageDataFormatSupported(bogus.format));
- bogus.bogus = 123;
- EXPECT(PP_FALSE == PPBImageData()->
- IsImageDataFormatSupported(bogus.format));
- TEST_PASSED;
-}
-
-// Tests PPB_ImageData::Create().
-void TestCreate() {
- PP_Resource image_data = kInvalidResource;
- BogusFormat bogus;
- // Invalid instance and valid size -> expect an invalid resource.
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, &kSmallImageSize, PP_FALSE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_RGBA_PREMUL, &kSmallImageSize, PP_FALSE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, &kSmallImageSize, PP_TRUE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_RGBA_PREMUL, &kSmallImageSize, PP_TRUE);
- EXPECT(image_data == kInvalidResource);
- // NULL size -> Internal error in rpc method, expect an invalid resource.
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, NULL, PP_FALSE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_RGBA_PREMUL, NULL, PP_FALSE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, NULL, PP_TRUE);
- EXPECT(image_data == kInvalidResource);
- image_data = PPBImageData()->Create(kInvalidInstance,
- PP_IMAGEDATAFORMAT_RGBA_PREMUL, NULL, PP_TRUE);
- EXPECT(image_data == kInvalidResource);
- // bogus image format -> expect an invalid resource.
- bogus.bogus = -1;
- image_data = PPBImageData()->Create(pp_instance(), bogus.format,
- &kSmallImageSize, PP_FALSE);
- EXPECT(image_data == kInvalidResource);
- bogus.bogus = 123;
- image_data = PPBImageData()->Create(pp_instance(), bogus.format,
- &kSmallImageSize, PP_TRUE);
- EXPECT(image_data == kInvalidResource);
-
- PP_Bool kPixelFill[] = {PP_FALSE, PP_TRUE};
- int kNumPixelFill = sizeof(kPixelFill) / sizeof(PP_Bool);
- PP_ImageDataFormat native_format = PPBImageData()->GetNativeImageDataFormat();
- for (int j = 0; j < kNumPixelFill; ++j) {
- // Valid instance and valid image size should generate a valid resource.
- for (int i = 0; i < kNumValidImages; ++i) {
- image_data = PPBImageData()->Create(pp_instance(), native_format,
- &kValidImageSize[i], kPixelFill[j]);
- EXPECT(image_data != kInvalidResource);
- PPBCore()->ReleaseResource(image_data);
- }
- // Valid instance and invalid size should generate an invalid resource.
- for (int i = 0; i < kNumInvalidImages; ++i) {
- image_data = PPBImageData()->Create(pp_instance(), native_format,
- &kInvalidImageSize[i], kPixelFill[j]);
- EXPECT(image_data == kInvalidResource);
- }
- }
- TEST_PASSED;
-}
-
-// Tests PPB_ImageData::IsImageData().
-void TestIsImageData() {
- // Invalid / non-existent / non-ImageData resource -> false.
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(kInvalidResource));
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(kNotAResource));
- PP_Resource url_loader = PPBURLLoader()->Create(pp_instance());
- CHECK(url_loader != kInvalidResource);
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(url_loader));
- PPBCore()->ReleaseResource(url_loader);
-
- PP_ImageDataFormat format = PPBImageData()->GetNativeImageDataFormat();
-
- // Created ImageData resource -> true.
- PP_Resource image_data = PPBImageData()->Create(
- pp_instance(), format, &kSmallImageSize, PP_TRUE);
- EXPECT(PP_TRUE == PPBImageData()->IsImageData(image_data));
-
- // Released ImageData resource -> false.
- PPBCore()->ReleaseResource(image_data);
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(image_data));
- TEST_PASSED;
-}
-
-// Tests PPB_ImageData::Describe().
-void TestDescribe() {
- PP_Resource image_data = kInvalidResource;
- PP_ImageDataFormat format = PPBImageData()->GetNativeImageDataFormat();
- PP_ImageDataDesc description;
-
- // Valid resource -> output = configuration, true.
- image_data = PPBImageData()->Create(pp_instance(), format, &kSmallImageSize,
- PP_FALSE);
- memset(&description, 0, sizeof(description));
- EXPECT(PP_TRUE == PPBImageData()->Describe(image_data, &description));
- EXPECT(description.format == format);
- EXPECT(IsEqualSize(description.size, kSmallImageSize));
- EXPECT(description.stride >= description.size.width *
- kPixelSizeInBytes);
- PPBCore()->ReleaseResource(image_data);
-
- image_data = PPBImageData()->Create(pp_instance(), format, &kSmallImageSize,
- PP_TRUE);
- memset(&description, 0, sizeof(description));
- EXPECT(PP_TRUE == PPBImageData()->Describe(image_data, &description));
- EXPECT(description.format == format);
- EXPECT(IsEqualSize(description.size, kSmallImageSize));
- EXPECT(description.stride >= description.size.width * kPixelSizeInBytes);
- PPBCore()->ReleaseResource(image_data);
-
- // NULL outputs -> output = unchanged, false.
- EXPECT(PP_FALSE == PPBImageData()->Describe(image_data, NULL));
-
- // Invalid / non-existent resource -> output = 0, false.
- memset(&description, 0, sizeof(description));
- EXPECT(PP_FALSE == PPBImageData()->Describe(kInvalidResource, &description));
- EXPECT(IsEqualSize(description.size, PP_MakeSize(0, 0)));
- EXPECT(PP_FALSE == PPBImageData()->Describe(kNotAResource, &description));
- EXPECT(IsEqualSize(description.size, PP_MakeSize(0, 0)));
- TEST_PASSED;
-}
-
-// Tests PPB_ImageData::Map() & PPB_ImageData::Unmap().
-void TestMapUnmap() {
- PP_Resource image_data = kInvalidResource;
- PP_ImageDataFormat format = PPBImageData()->GetNativeImageDataFormat();
- PP_ImageDataDesc description;
- uint8_t *pixel_byte_ptr;
- uint8_t *pixel_byte_ptr2;
- uint8_t pixel_bytes_or_together;
- image_data = PPBImageData()->Create(pp_instance(), format, &kSmallImageSize,
- PP_TRUE);
- EXPECT(PP_TRUE == PPBImageData()->Describe(image_data, &description));
- int image_size_in_bytes = description.stride * description.size.height;
- pixel_byte_ptr = static_cast<uint8_t *>(PPBImageData()->Map(image_data));
- EXPECT(NULL != pixel_byte_ptr);
- pixel_bytes_or_together = 0;
- // The image was created with a request to zero fill, so verify that
- // memory is zero filled.
- for (int i = 0; i < image_size_in_bytes; ++i) {
- pixel_bytes_or_together = pixel_bytes_or_together | pixel_byte_ptr[i];
- }
- EXPECT(0 == pixel_bytes_or_together);
- PPBImageData()->Unmap(image_data);
- PPBCore()->ReleaseResource(image_data);
- // The following shouldn't crash -- it attempts to map an image resource more
- // than once, then it attempts to release the resource, then calls unmap with
- // the released resource. It then attempts to re-map the resource, which
- // should return a NULL pointer.
- image_data = PPBImageData()->Create(pp_instance(), format, &kSmallImageSize,
- PP_TRUE);
- pixel_byte_ptr = static_cast<uint8_t *>(PPBImageData()->Map(image_data));
- EXPECT(NULL != pixel_byte_ptr);
- pixel_byte_ptr2 = static_cast<uint8_t *>(PPBImageData()->Map(image_data));
- EXPECT(pixel_byte_ptr == pixel_byte_ptr2);
- PPBCore()->ReleaseResource(image_data);
- PPBImageData()->Unmap(image_data);
- pixel_byte_ptr = static_cast<uint8_t *>(PPBImageData()->Map(image_data));
- EXPECT(NULL == pixel_byte_ptr);
- // Attempt to call map/unmap with a few other non-image data resources.
- pixel_byte_ptr = static_cast<uint8_t *>(PPBImageData()->
- Map(kInvalidResource));
- EXPECT(NULL == pixel_byte_ptr);
- PPBImageData()->Unmap(kInvalidResource);
- PP_Resource url_loader = PPBURLLoader()->Create(pp_instance());
- CHECK(url_loader != kInvalidResource);
- pixel_byte_ptr = static_cast<uint8_t *>(PPBImageData()->Map(url_loader));
- EXPECT(NULL == pixel_byte_ptr);
- PPBCore()->ReleaseResource(url_loader);
- TEST_PASSED;
-}
-
-// Stress testing creation of a large number of small images.
-void TestStressPartA() {
- PP_ImageDataFormat format = PPBImageData()->GetNativeImageDataFormat();
- for (int i = 0; i < kManyResources; ++i) {
- image_data[i] = kInvalidResource;
- }
- // Create a large number of co-existing memory mapped small images.
- for (int i = 0; i < kManyResources; ++i) {
- image_data[i] = PPBImageData()->Create(pp_instance(), format,
- &kSmallImageSize, PP_TRUE);
- EXPECT(image_data[i] != kInvalidResource);
- // Check to see if resource id is duplicate.
- // TODO(nfullagar): This could be done faster if the test needs to increase
- // the number of resources to create.
- for (int j = 0; j < i; ++j) {
- EXPECT(image_data[j] != image_data[i]);
- }
- EXPECT(PP_TRUE == PPBImageData()->IsImageData(image_data[i]));
- uint32_t* pixel_ptr = NULL;
- pixel_ptr = static_cast<uint32_t*>(PPBImageData()->Map(image_data[i]));
- EXPECT(NULL != pixel_ptr);
- // Attempt to write first pixel.
- pixel_ptr[0] = 0;
- }
- TEST_PASSED;
-}
-
-// Stress testing many create / release of large images.
-void TestStressPartB() {
- PP_Resource large_image_data;
- PP_ImageDataFormat format = PPBImageData()->GetNativeImageDataFormat();
- // A large number of create-map-unmap-release large images.
- // Only one large image exists at a time; make sure memory space isn't
- // exhausted. See issue:
- // http://code.google.com/p/chromium/issues/detail?id=120728
- for (int i = 0; i < kManyLargeResources; i++) {
- large_image_data = PPBImageData()->Create(pp_instance(), format,
- &kLargeImageSize, PP_TRUE);
- EXPECT(large_image_data != kInvalidResource);
- EXPECT(PP_TRUE == PPBImageData()->IsImageData(large_image_data));
- uint32_t* pixel_ptr = NULL;
- pixel_ptr = static_cast<uint32_t*>(PPBImageData()->Map(large_image_data));
- EXPECT(NULL != pixel_ptr);
- // Scatter write across many pixels in the large image.
- const int scatter_delta = 16;
- for (int y = 0; y < kLargeImageSize.height; y += scatter_delta)
- for (int x = 0; x < kLargeImageSize.width; x += scatter_delta)
- pixel_ptr[y * kLargeImageSize.width + x] = 0;
- PPBImageData()->Unmap(large_image_data);
- PPBCore()->ReleaseResource(large_image_data);
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(large_image_data));
- }
- TEST_PASSED;
-}
-
-// Release the collection of small images created in part A.
-void TestStressPartC() {
- // Go back and unmap the smaller images.
- for (int i = 0; i < kManyResources; i++) {
- if (image_data[i] != kInvalidResource) {
- PPBImageData()->Unmap(image_data[i]);
- EXPECT(PP_TRUE == PPBImageData()->IsImageData(image_data[i]));
- PPBCore()->ReleaseResource(image_data[i]);
- EXPECT(PP_FALSE == PPBImageData()->IsImageData(image_data[i]));
- }
- }
- TEST_PASSED;
-}
-} // namespace
-
-void SetupTests() {
- RegisterTest("TestGetNativeImageDataFormat", TestGetNativeImageDataFormat);
- RegisterTest("TestIsImageDataFormatSupported",
- TestIsImageDataFormatSupported);
- RegisterTest("TestCreate", TestCreate);
- RegisterTest("TestIsImageData", TestIsImageData);
- RegisterTest("TestDescribe", TestDescribe);
- RegisterTest("TestMapUnmap", TestMapUnmap);
- RegisterTest("TestStressPartA", TestStressPartA);
- RegisterTest("TestStressPartB", TestStressPartB);
- RegisterTest("TestStressPartC", TestStressPartC);
-}
-
-void SetupPluginInterfaces() {
- // none
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.html b/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.html
deleted file mode 100644
index 75fad7c..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppb_image_data/ppapi_ppb_image_data.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <!-- Copyright (c) 2011 Google Inc. All rights reserved. -->
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
- <META HTTP-EQUIV="Expires" CONTENT="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <script type="application/x-javascript">
-//<![CDATA[
-function setupTests(tester, plugin) {
- function testAndAssertStatus(test, name, status) {
- var messageListener = test.wrap(function(message) {
- plugin.removeEventListener('message', messageListener, false);
- test.assertEqual(message.data, name + ':' + status);
- test.pass();
- });
- plugin.addEventListener('message', messageListener, false);
- plugin.postMessage(name);
- }
-
- tester.addAsyncTest('PPB_ImageData::GetNativeImageDataFormat',
- function(test) {
- testAndAssertStatus(test, 'TestGetNativeImageDataFormat', 'PASSED');
- }
- );
- tester.addAsyncTest('PPB_ImageData::IsImageDataFormatSupported',
- function(test) {
- testAndAssertStatus(test, 'TestIsImageDataFormatSupported', 'PASSED');
- }
- );
- tester.addAsyncTest('PPB_ImageData::Create', function(test) {
- testAndAssertStatus(test, 'TestCreate', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::IsImageData', function(test) {
- testAndAssertStatus(test, 'TestIsImageData', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::Describe', function(test) {
- testAndAssertStatus(test, 'TestDescribe', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::MapUnmap', function(test) {
- testAndAssertStatus(test, 'TestMapUnmap', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::StressPartA', function(test) {
- testAndAssertStatus(test, 'TestStressPartA', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::StressPartB', function(test) {
- testAndAssertStatus(test, 'TestStressPartB', 'PASSED');
- });
- tester.addAsyncTest('PPB_ImageData::StressPartC', function(test) {
- testAndAssertStatus(test, 'TestStressPartC', 'PASSED');
- });
-}
-//]]>
- </script>
- <title>PPAPI PPB_ImageData Test</title>
- </head>
- <body>
- <h1>PPAPI PPB_ImageData Test</h1>
- NOTE: requires --enable-pepper-testing
- <br><br>
- <table>
- <tr>
- <td>
- <embed type="application/x-nacl" id="test_nexe"
- name="nacl_module"
- src="ppapi_ppb_image_data.nmf"
- style="background-color:#FFFFFF"
- width="90" height="90" />
- <table>
- <br>
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- setupTests(tester, $('test_nexe'));
- tester.waitFor($('test_nexe'));
- tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/nacl.scons b/ppapi/native_client/tests/ppapi_browser/ppp_input_event/nacl.scons
deleted file mode 100644
index 9976f95..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/nacl.scons
+++ /dev/null
@@ -1,40 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2012 The Native Client 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 uses ppapi_test_lib.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/' +
- 'ppp_input_event')
-
-nexe = env.ProgramNameForNmf('ppapi_ppp_input_event')
-env.Alias('ppapi_ppp_input_event${PROGSUFFIX}',
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-
-ppapi_ppp_input_event_nexe = env.ComponentProgram(
- nexe,
- ['ppapi_ppp_input_event.cc'],
- EXTRA_LIBS=['ppapi',
- 'ppapi_test_lib',
- 'platform', # for CHECK
- 'pthread',
- 'gio',
- ])
-
-env.Publish(nexe, 'run',
- ['ppapi_ppp_input_event.html',
- 'ppapi_ppp_input_event.js'])
-
-node = env.PPAPIBrowserTester('ppapi_ppp_input_event_browser_test.out',
- url='ppapi_ppp_input_event.html',
- nmf_names=['ppapi_ppp_input_event'],
- files=env.ExtractPublishedFiles(nexe))
-
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_ppapi_ppp_input_event_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.cc b/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.cc
deleted file mode 100644
index 517b161..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.cc
+++ /dev/null
@@ -1,214 +0,0 @@
-// Copyright (c) 2011 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.
-
-#include <string.h>
-
-#include <vector>
-
-#include "native_client/src/include/nacl/nacl_inttypes.h"
-#include "native_client/src/include/nacl_macros.h"
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
-#include "native_client/tests/ppapi_test_lib/test_interface.h"
-
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_input_event.h"
-#include "ppapi/c/ppb_input_event.h"
-#include "ppapi/c/ppp_input_event.h"
-
-namespace {
-
-// These define whether we want an input event to bubble up to the browser
-static enum {
- BUBBLE_UNDEFINED,
- BUBBLE_YES,
- BUBBLE_NO
-} bubbleInputEvent;
-
-PP_TimeTicks last_time_tick;
-
-std::string InputEventTypeToString(PP_InputEvent_Type type) {
- switch (type) {
- case PP_INPUTEVENT_TYPE_UNDEFINED:
- return "PP_INPUTEVENT_TYPE_UNDEFINED";
- case PP_INPUTEVENT_TYPE_MOUSEDOWN:
- return "PP_INPUTEVENT_TYPE_MOUSEDOWN";
- case PP_INPUTEVENT_TYPE_MOUSEUP:
- return "PP_INPUTEVENT_TYPE_MOUSEUP";
- case PP_INPUTEVENT_TYPE_MOUSEMOVE:
- return "PP_INPUTEVENT_TYPE_MOUSEMOVE";
- case PP_INPUTEVENT_TYPE_MOUSEENTER:
- return "PP_INPUTEVENT_TYPE_MOUSEENTER";
- case PP_INPUTEVENT_TYPE_MOUSELEAVE:
- return "PP_INPUTEVENT_TYPE_MOUSELEAVE";
- case PP_INPUTEVENT_TYPE_WHEEL:
- return "PP_INPUTEVENT_TYPE_WHEEL";
- case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
- return "PP_INPUTEVENT_TYPE_RAWKEYDOWN";
- case PP_INPUTEVENT_TYPE_KEYDOWN:
- return "PP_INPUTEVENT_TYPE_KEYDOWN";
- case PP_INPUTEVENT_TYPE_KEYUP:
- return "PP_INPUTEVENT_TYPE_KEYUP";
- case PP_INPUTEVENT_TYPE_CHAR:
- return "PP_INPUTEVENT_TYPE_CHAR";
- case PP_INPUTEVENT_TYPE_CONTEXTMENU:
- return "PP_INPUTEVENT_TYPE_CONTEXTMENU";
- default:
- std::ostringstream stream;
- stream << "Unknown Input Event: " << type;
- return stream.str();
- }
-}
-
-std::string InputEventModifierToString(uint32_t modifier) {
- struct ModifierStringMap {
- PP_InputEvent_Modifier modifier;
- const char* name;
- };
- static const ModifierStringMap table[] = {
- { PP_INPUTEVENT_MODIFIER_SHIFTKEY, "PP_INPUTEVENT_MODIFIER_SHIFTKEY" },
- { PP_INPUTEVENT_MODIFIER_CONTROLKEY, "PP_INPUTEVENT_MODIFIER_CONTROLKEY" },
- { PP_INPUTEVENT_MODIFIER_ALTKEY, "PP_INPUTEVENT_MODIFIER_ALTKEY" },
- { PP_INPUTEVENT_MODIFIER_METAKEY, "PP_INPUTEVENT_MODIFIER_METAKEY" },
- { PP_INPUTEVENT_MODIFIER_ISKEYPAD, "PP_INPUTEVENT_MODIFIER_ISKEYPAD" },
- { PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT,
- "PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT" },
- { PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN,
- "PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN" },
- { PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN,
- "PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN" },
- { PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN,
- "PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN" },
- { PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY,
- "PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY" },
- { PP_INPUTEVENT_MODIFIER_NUMLOCKKEY, "PP_INPUTEVENT_MODIFIER_NUMLOCKKEY" },
- };
-
- std::ostringstream stream;
- for (int i = 0; i < int(sizeof(table) / sizeof(*table)); ++i) {
- if (table[i].modifier & modifier) {
- if (stream.str().size() != 0) {
- stream << ",";
- }
- stream << table[i].name;
- modifier &= ~table[i].modifier;
- }
- }
-
- if (modifier != 0) {
- if (stream.str().size() != 0) {
- stream << ",";
- }
- stream << "Unknown Modifier Bits:" << modifier;
- }
- return stream.str();
-}
-
-std::string MouseButtonToString(PP_InputEvent_MouseButton button) {
- switch (button) {
- case PP_INPUTEVENT_MOUSEBUTTON_NONE:
- return "PP_INPUTEVENT_MOUSEBUTTON_NONE";
- case PP_INPUTEVENT_MOUSEBUTTON_LEFT:
- return "PP_INPUTEVENT_MOUSEBUTTON_LEFT";
- case PP_INPUTEVENT_MOUSEBUTTON_MIDDLE:
- return "PP_INPUTEVENT_MOUSEBUTTON_MIDDLE";
- case PP_INPUTEVENT_MOUSEBUTTON_RIGHT:
- return "PP_INPUTEVENT_MOUSEBUTTON_RIGHT";
- default:
- std::ostringstream stream;
- stream << "Unrecognized ("
- << static_cast<int32_t>(button)
- << ")";
- return stream.str();
- }
-}
-
-PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource event) {
- EXPECT(instance == pp_instance());
- EXPECT(PPBInputEvent()->IsInputEvent(event));
- PP_InputEvent_Type type = PPBInputEvent()->GetType(event);
- PP_TimeTicks ticks = PPBInputEvent()->GetTimeStamp(event);
- EXPECT(ticks >= last_time_tick);
- last_time_tick = ticks;
- uint32_t modifiers = PPBInputEvent()->GetModifiers(event);
- printf("--- PPP_InputEvent::HandleInputEvent "
- "type=%d, ticks=%f, modifiers=%"NACL_PRIu32"\n",
- static_cast<int>(type), ticks, modifiers);
- std::ostringstream message;
- message << InputEventTypeToString(type) << ":" <<
- InputEventModifierToString(modifiers);
- if (PPBMouseInputEvent()->IsMouseInputEvent(event)) {
- PP_Point point = PPBMouseInputEvent()->GetPosition(event);
- message << ":" << MouseButtonToString(
- PPBMouseInputEvent()->GetButton(event));
- message << ":Position=" << point.x << "," << point.y;
- message << ":ClickCount=" << PPBMouseInputEvent()->GetClickCount(event);
- }
- // Here's a example of what a complete response would look like for a mouse
- // click (broken into multiple lines for readability):
- // HandleInputEvent:PP_INPUTEVENT_TYPE_MOUSEDOWN
- // :PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN
- // :PP_INPUTEVENT_MOUSEBUTTON_LEFT
- // :Position=0,0:ClickCount=1
- // TODO(mball) Add output for WheelInputEvent and KeyboardInputEvent
-
- PostTestMessage("HandleInputEvent", message.str());
- EXPECT(bubbleInputEvent == BUBBLE_YES || bubbleInputEvent == BUBBLE_NO);
- return (bubbleInputEvent == BUBBLE_NO) ? PP_TRUE : PP_FALSE;
-}
-
-void TestUnfilteredMouseEvents() {
- EXPECT(PPBInputEvent()->RequestInputEvents(
- pp_instance(),
- PP_INPUTEVENT_CLASS_MOUSE) == PP_OK);
- bubbleInputEvent = BUBBLE_NO;
- TEST_PASSED;
-}
-
-void TestBubbledMouseEvents() {
- EXPECT(PPBInputEvent()->RequestFilteringInputEvents(
- pp_instance(),
- PP_INPUTEVENT_CLASS_MOUSE) == PP_OK);
- bubbleInputEvent = BUBBLE_YES;
- TEST_PASSED;
-}
-
-void TestUnbubbledMouseEvents() {
- EXPECT(PPBInputEvent()->RequestFilteringInputEvents(
- pp_instance(),
- PP_INPUTEVENT_CLASS_MOUSE) == PP_OK);
- bubbleInputEvent = BUBBLE_NO;
- TEST_PASSED;
-}
-
-void Cleanup() {
- PPBInputEvent()->ClearInputEventRequest(
- pp_instance(),
- PP_INPUTEVENT_CLASS_MOUSE |
- PP_INPUTEVENT_CLASS_WHEEL |
- PP_INPUTEVENT_CLASS_KEYBOARD);
- bubbleInputEvent = BUBBLE_UNDEFINED;
- TEST_PASSED;
-}
-
-const PPP_InputEvent ppp_input_event_interface = {
- &HandleInputEvent
-};
-
-} // namespace
-
-void SetupTests() {
- bubbleInputEvent = BUBBLE_UNDEFINED;
- last_time_tick = 0.0;
- RegisterTest("TestUnfilteredMouseEvents", TestUnfilteredMouseEvents);
- RegisterTest("TestBubbledMouseEvents", TestBubbledMouseEvents);
- RegisterTest("TestUnbubbledMouseEvents", TestUnbubbledMouseEvents);
- RegisterTest("Cleanup", Cleanup);
-}
-
-void SetupPluginInterfaces() {
- RegisterPluginInterface(PPP_INPUT_EVENT_INTERFACE,
- &ppp_input_event_interface);
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.html b/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.html
deleted file mode 100644
index 7e9f53d..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <!-- Copyright (c) 2011 Google Inc. All rights reserved. -->
- <head>
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <script type="text/javascript" src="ppapi_ppp_input_event.js"></script>
- <title>PPAPI PPP_InputEvent Test</title>
- </head>
- <body>
- <h1>PPAPI PPP_InputEvent Test</h1>
-
- <div id="test_nexe_parent">
- <embed type="application/x-nacl" id="test_nexe"
- name="nacl_module"
- src="ppapi_ppp_input_event.nmf"
- style="background-color:#AAAAAA"
- width="15" height="20" />
- </div>
- <br/>
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- setupTests(tester, $('test_nexe'));
- tester.waitFor($('test_nexe'));
- tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.js b/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.js
deleted file mode 100644
index c934144..0000000
--- a/ppapi/native_client/tests/ppapi_browser/ppp_input_event/ppapi_ppp_input_event.js
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (c) 2011 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.
-
-function setupTests(tester, plugin) {
- //////////////////////////////////////////////////////////////////////////////
- // Test Helpers
- //////////////////////////////////////////////////////////////////////////////
-
- // These are the coordinates of the upper-left corner of the nacl plugin
- var leftCorner = plugin.offsetLeft;
- var topCorner = plugin.offsetTop;
-
- function simulateMouseEvent(eventName) {
- var event = document.createEvent('MouseEvents');
- event.initMouseEvent(
- eventName,
- true, // bubbles
- true, // cancelable
- document.defaultView,
- 1, // one click
- 0, 0, // Screen coordinate
- leftCorner, topCorner, // Client coordinate
- false, false, false, false, // no key modifiers
- 0, // button: 0 - left, 1 - middle, 2 - right
- null); // no related targets
- plugin.dispatchEvent(event);
- }
-
- function addTest(testName, testCaseEvent, eventResponse,
- eventGeneratorCallback) {
- tester.addAsyncTest('PPP_InputEvent::' + testName + '_' + testCaseEvent,
- function(test) {
- var messages = [testName + ':PASSED',
- 'HandleInputEvent:' + eventResponse,
- 'Cleanup:PASSED'];
- // TODO(mball,polina): These listener functions should fail when an event
- // is not bubbled up from the Nacl module.
- var pluginListener = test.wrap(function(message) {
- test.log('plugin received ' + message);
- });
- var parentListener = test.wrap(function(message) {
- test.log('plugin.parentNode received ' + message);
- });
- test.expectMessageSequence(
- plugin, messages,
- function(message) {
- if (message == messages[0]) {
- // TODO(polina): why does this forward and bubble the event even
- // though it was handled? Based on headers, the listeners below
- // should contain test.fail(). Figure out if this is a bug
- // (crbug.com/88728) or if the header comments are off.
- plugin.addEventListener(testCaseEvent, pluginListener, false);
- plugin.parentNode.addEventListener(
- testCaseEvent, parentListener, false);
- eventGeneratorCallback(testCaseEvent);
- } else if (message == messages[1]) {
- plugin.removeEventListener(testCaseEvent, pluginListener, false);
- plugin.parentNode.removeEventListener(
- testCaseEvent, parentListener, false);
- plugin.postMessage('Cleanup');
- } else if (message != messages[2]) {
- test.fail('Unknown message: ' + message);
- }
- });
- plugin.postMessage(testName);
- });
- }
-
- //////////////////////////////////////////////////////////////////////////////
- // Tests
- //////////////////////////////////////////////////////////////////////////////
- var mouseEventTests = [
- 'TestUnfilteredMouseEvents',
- 'TestBubbledMouseEvents',
- 'TestUnbubbledMouseEvents'];
-
- mouseEventTests.map(function(testName) {
- addTest(
- testName,
- 'mousedown',
- 'PP_INPUTEVENT_TYPE_MOUSEDOWN' +
- ':PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN' +
- ':PP_INPUTEVENT_MOUSEBUTTON_LEFT' +
- ':Position=0,0:ClickCount=1',
- simulateMouseEvent);
- });
-}