summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 22:39:22 +0000
committerncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-11 22:39:22 +0000
commitb170daf3f5ce4572e86d1fb716a6e68b27c1b550 (patch)
tree2385e455c7372029342bcee2a13fa6d7fc79893d
parent47ca854e3b4c437a61988ecfdd1f601c753e9f77 (diff)
downloadchromium_src-b170daf3f5ce4572e86d1fb716a6e68b27c1b550.zip
chromium_src-b170daf3f5ce4572e86d1fb716a6e68b27c1b550.tar.gz
chromium_src-b170daf3f5ce4572e86d1fb716a6e68b27c1b550.tar.bz2
Remove PPAPI tests from NaCl's SCons build that are not automated or are dead.
BUG= http://code.google.com/p/chromium/issues/detail?id=154400 Review URL: https://chromiumcodereview.appspot.com/11088017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161425 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/native_client/ppapi_scons_files.py13
-rw-r--r--ppapi/native_client/tests/earth/DEPS9
-rw-r--r--ppapi/native_client/tests/earth/README.txt18
-rw-r--r--ppapi/native_client/tests/earth/earth.cc830
-rw-r--r--ppapi/native_client/tests/earth/earth.h26
-rw-r--r--ppapi/native_client/tests/earth/earth_c.html57
-rw-r--r--ppapi/native_client/tests/earth/earth_c.nmf.dsoexample30
-rw-r--r--ppapi/native_client/tests/earth/earth_cc.html58
-rw-r--r--ppapi/native_client/tests/earth/nacl.scons77
-rw-r--r--ppapi/native_client/tests/earth/pepper_c.c229
-rw-r--r--ppapi/native_client/tests/earth/pepper_cc.cc127
-rw-r--r--ppapi/native_client/tests/ppapi_example_2d/nacl.scons22
-rw-r--r--ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.html25
-rw-r--r--ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_example_audio/audio.cc320
-rw-r--r--ppapi/native_client/tests/ppapi_example_audio/nacl.scons27
-rw-r--r--ppapi/native_client/tests/ppapi_example_audio/ppapi_example_audio.html71
-rw-r--r--ppapi/native_client/tests/ppapi_example_events/nacl.scons21
-rw-r--r--ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.cc210
-rw-r--r--ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html67
-rw-r--r--ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_example_gles2/nacl.scons39
-rw-r--r--ppapi/native_client/tests/ppapi_example_gles2/ppapi_example_gles2.html51
-rw-r--r--ppapi/native_client/tests/ppapi_example_post_message/nacl.scons36
-rw-r--r--ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html60
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/nacl.scons92
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book.html101
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_hello_triangle.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_mip_map_2d.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_2d.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_cubemap.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_vertex_shader.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_stencil_test.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_texture_wrap.nmf7
-rw-r--r--ppapi/native_client/tests/ppapi_simple_tests/nacl.scons71
-rw-r--r--ppapi/native_client/tests/ppapi_test_example/nacl.scons49
-rw-r--r--ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.cc46
-rw-r--r--ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.html31
-rw-r--r--ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.js41
-rw-r--r--ppapi/native_client/tests/ppapi_tests/nacl.scons114
-rw-r--r--ppapi/native_client/tests/ppapi_tests/test_case.nmf7
-rw-r--r--ppapi/ppapi_tests.gypi2
-rw-r--r--ppapi/tests/ppapi_nacl_tests_newlib.nmf (renamed from ppapi/native_client/tests/ppapi_tests/ppapi_nacl_tests_newlib.nmf)0
43 files changed, 1 insertions, 3039 deletions
diff --git a/ppapi/native_client/ppapi_scons_files.py b/ppapi/native_client/ppapi_scons_files.py
index 39d29d2..ae1e4b4 100644
--- a/ppapi/native_client/ppapi_scons_files.py
+++ b/ppapi/native_client/ppapi_scons_files.py
@@ -40,21 +40,8 @@ nonvariant_test_scons_files = [
'tests/ppapi_browser/ppp_instance/nacl.scons',
'tests/ppapi_browser/progress_events/nacl.scons',
'tests/ppapi_browser/stress_many_nexes/nacl.scons',
- 'tests/ppapi_example_2d/nacl.scons',
- 'tests/ppapi_example_audio/nacl.scons',
- 'tests/ppapi_example_events/nacl.scons',
- # TODO(dspringer): re-enable test once the 3D ABI has stabilized. See
- # http://code.google.com/p/nativeclient/issues/detail?id=2060
- # 'tests/ppapi_example_gles2/nacl.scons',
- 'tests/ppapi_example_post_message/nacl.scons',
'tests/ppapi_geturl/nacl.scons',
- 'tests/ppapi_gles_book/nacl.scons',
'tests/ppapi_messaging/nacl.scons',
- # Broken by Chrome change
- # http://code.google.com/p/nativeclient/issues/detail?id=2480
- #'tests/ppapi_simple_tests/nacl.scons',
- 'tests/ppapi_test_example/nacl.scons',
'tests/ppapi_test_lib/nacl.scons',
- 'tests/ppapi_tests/nacl.scons',
]
diff --git a/ppapi/native_client/tests/earth/DEPS b/ppapi/native_client/tests/earth/DEPS
deleted file mode 100644
index 58de7ba..0000000
--- a/ppapi/native_client/tests/earth/DEPS
+++ /dev/null
@@ -1,9 +0,0 @@
-include_rules = [
- # TODO(bradnelson): Eliminate these rules. While we should keep this test,
- # it does not currently appear to be connected to the build.
- # It also appears to have bit-rotted as native_client/common/worker.h seems to
- # be an obsolete filename.
- # Once it is building, it shouldn't use files from native_client.
- "+native_client/tests/earth",
- "+native_client/common",
-]
diff --git a/ppapi/native_client/tests/earth/README.txt b/ppapi/native_client/tests/earth/README.txt
deleted file mode 100644
index 790b74b..0000000
--- a/ppapi/native_client/tests/earth/README.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-A rotating earth demo for Native Client
-
-Image Credit:
-
-NASA Goddard Space Flight Center Image by Reto Stöckli (land surface,
-shallow water, clouds). Enhancements by Robert Simmon (ocean color,
-compositing, 3D globes, animation).
-Data and technical support: MODIS Land Group; MODIS Science Data
-Support Team; MODIS Atmosphere Group; MODIS Ocean Group Additional data:
-USGS EROS Data Center (topography); USGS Terrestrial Remote Sensing
-Flagstaff Field Center (Antarctica); Defense Meteorological
-Satellite Program (city lights).
-
-The Visible Earth:
- http://visibleearth.nasa.gov/
-
-Earth image (2048x1024 version):
- http://visibleearth.nasa.gov/view_rec.php?id=2433
diff --git a/ppapi/native_client/tests/earth/earth.cc b/ppapi/native_client/tests/earth/earth.cc
deleted file mode 100644
index 71854df..0000000
--- a/ppapi/native_client/tests/earth/earth.cc
+++ /dev/null
@@ -1,830 +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.
- */
-
-// NaCl Earth demo
-// Ray trace planet Earth
-
-#include "native_client/tests/earth/earth.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <math.h>
-#include <pthread.h>
-#include <semaphore.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define HAVE_THREADS 1
-#include "native_client/common/worker.h"
-
-// print/debug messages
-static void InfoPrintf(const char *fmt, ...) {
- va_list argptr;
- va_start (argptr, fmt);
- vfprintf (stderr, fmt, argptr);
- va_end (argptr);
- fflush(stderr);
-}
-
-extern "C" void DebugPrintf(const char *fmt, ...) {
- va_list argptr;
- fprintf (stderr, "@@@ EARTH ");
-
- va_start (argptr, fmt);
- vfprintf (stderr, fmt, argptr);
- va_end (argptr);
- fflush(stderr);
-}
-
-// global properties
-const float kPI = M_PI;
-const float kOneOverPI = 1.0f / kPI;
-const float kOneOver2PI = 1.0f / (2.0f * kPI);
-const float kOneOver255 = 1.0f / 255.0f;
-const int kArcCosineTableSize = 4096;
-const float kMaxWindow = 4096;
-const int kEarthTextureWidth = 1024;
-const int kEarthTextureHeight = 512;
-const int kMaxFrames = 1000000;
-const int kRegionRatio = 8;
-int g_window_width = 512;
-int g_window_height = 512;
-int g_num_frames = 300;
-bool g_ask_sysconf = true;
-int g_num_threads = 4; // possibly overridden by sysconf()
-int g_num_regions = 4; // possibly overridden by sysconf()
-bool g_multi_threading = false; // can be overridden on cmd line
-
-int g_frame_checksum = 0; // used for nacl module testing
-
-// seed for rand_r() - we only call rand_r from main thread.
-static unsigned int g_seed = 0xC0DE533D;
-
-// random number helper
-inline unsigned char rand255() {
- return static_cast<unsigned char>(rand_r(&g_seed) & 255);
-}
-
-// random number helper
-inline float frand() {
- return (static_cast<float>(rand_r(&g_seed)) / static_cast<float>(RAND_MAX));
-}
-
-// build a packed color
-inline uint32_t MakeRGBA(uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
- return (((a) << 24) | ((r) << 16) | ((g) << 8) | (b));
-}
-
-// extraction routines
-inline float ExtractR(uint32_t c) {
- return static_cast<float>(c & 0xFF) * kOneOver255;
-}
-
-inline float ExtractG(uint32_t c) {
- return static_cast<float>((c & 0xFF00) >> 8) * kOneOver255;
-}
-
-inline float ExtractB(uint32_t c) {
- return static_cast<float>((c & 0xFF0000) >> 16) * kOneOver255;
-}
-
-
-// simple container for earth texture
-struct Texture {
- int width, height;
- unsigned int pixels[kEarthTextureWidth * kEarthTextureHeight];
-};
-
-
-// compile our texture straight in to avoid runtime filesystem
-Texture g_earth = {
- kEarthTextureWidth, kEarthTextureHeight, {
-#include "native_client/tests/earth/earth_image.inc"
- }
-};
-
-
-struct Surface {
- int width, height, pitch;
- uint32_t *pixels;
- Surface(uint32_t *pix, int w, int h) {
- width = w;
- height = h;
- pitch = w;
- pixels = pix;
- }
-};
-
-
-struct ArcCosine {
- // slightly larger table so we can interpolate beyond table size
- float table[kArcCosineTableSize + 2];
- float TableLerp(float x);
- ArcCosine();
- ~ArcCosine() { ; }
-};
-
-
-ArcCosine::ArcCosine() {
- // build a slightly larger table to allow for numeric imprecision
- for (int i = 0; i < (kArcCosineTableSize + 2); ++i) {
- float f = static_cast<float>(i) / kArcCosineTableSize;
- f = f * 2.0f - 1.0f;
- table[i] = acos(f);
- }
-}
-
-
-// looks up acos(f) using a table and lerping between entries
-// (it is expected that input f is between -1 and 1)
-float ArcCosine::TableLerp(float f) {
- float x = (f + 1.0f) * 0.5f;
- x = x * kArcCosineTableSize;
- int ix = static_cast<int>(x);
- float fx = static_cast<float>(ix);
- float dx = x - fx;
- float af = table[ix];
- float af2 = table[ix + 1];
- float a = af + (af2 - af) * dx;
- return a;
-}
-
-
-// takes a -0..1+ color, clamps it to 0..1 and maps it to 0..255 integer
-inline unsigned int Clamp255(float x) {
- if (x < 0.0f) {
- x = 0.0f;
- } else if (x > 1.0f) {
- x = 1.0f;
- }
- return (unsigned int)(x * 255.0f);
-}
-
-
-// Planet class holds information and functionality needed to render
-// a ray-traced planet into an raw pixel surface
-class Planet {
- float planet_radius_;
- float planet_spin_;
- float planet_x_, planet_y_, planet_z_;
- float planet_pole_x_, planet_pole_y_, planet_pole_z_;
- float planet_equator_x_, planet_equator_y_, planet_equator_z_;
- float eye_x_, eye_y_, eye_z_;
- float light_x_, light_y_, light_z_;
- float diffuse_r_, diffuse_g_, diffuse_b_;
- float ambient_r_, ambient_g_, ambient_b_;
-
- // cached calculations
- float planet_xyz_;
- float planet_pole_x_equator_x_;
- float planet_pole_x_equator_y_;
- float planet_pole_x_equator_z_;
- float planet_radius2_;
- float planet_one_over_radius_;
- float eye_xyz_;
-
- // misc
- Texture *tex_;
- Surface surface_;
- ArcCosine acos_;
- int num_regions_;
- WorkerThreadManager *workers_;
- volatile bool exiting_;
- bool rendering_;
-
-public:
-
- // methods prefixed with 'w' are only called by worker threads!
- // (unless MULTI_THREADING is false)
- uint32_t* wGetAddr(int x, int y);
- void wRenderPixelSpan(int x0, int x1, int y);
- void wMakeRect(int r, int *x, int *y, int *w, int *h);
- void wRenderRect(int x0, int y0, int x1, int y1);
- void wWorkerThreadEntry();
-
- // these methods are only called by the main thread
- void CacheCalcs();
- void SetPlanetXYZR(float x, float y, float z, float r);
- void SetPlanetPole(float x, float y, float z);
- void SetPlanetEquator(float x, float y, float z);
- void SetPlanetSpin(float a);
- void SetEyeXYZ(float x, float y, float z);
- void SetLightXYZ(float x, float y, float z);
- void SetAmbientRGB(float r, float g, float b);
- void SetDiffuseRGB(float r, float g, float b);
- void SetSurface(Surface surface);
- bool CreateWorkerThreads(int num);
- void UpdateSim();
- void ParallelRender();
- void ParallelRenderSync();
- void SequentialRender();
- void Render();
- void Sync();
- Planet(int numRegions, bool multithreading, Texture *tex);
- ~Planet();
-};
-
-// Given a region r, derive a rectangle. Currently this function
-// slices the main output buffer into equal sized rows.
-// This function is used to convert a mutex guarded counter into
-// a rectangular region for a given worker thread to process.
-// This rectangle shouldn't overlap with work being done by other workers.
-// If multithreading, this function is only called by the worker threads.
-void Planet::wMakeRect(int r, int *x, int *y, int *w, int *h) {
- int dy = surface_.height / num_regions_;
- *x = 0;
- *w = surface_.width;
- *y = r * dy;
- *h = dy;
-}
-
-
-inline uint32_t* Planet::wGetAddr(int x, int y) {
- assert(surface_.pixels);
- return (surface_.pixels + y * surface_.pitch) + x;
-}
-
-
-union Convert {
- float f;
- int i;
- Convert(int x) { i = x; }
- Convert(float x) { f = x; }
- const int asInt() { return i; }
- const float asFloat() { return f; }
-};
-
-
-inline const int AsInteger(const float f) {
- Convert u(f);
- return u.asInt();
-}
-
-
-inline const float AsFloat(const int i) {
- Convert u(i);
- return u.asFloat();
-}
-
-
-const long int kOneAsInteger = AsInteger(1.0f);
-const float kScaleUp = float(0x00800000);
-const float kScaleDown = 1.0f / kScaleUp;
-
-
-inline float inline_quick_sqrt(float x) {
- int i;
- i = (AsInteger(x) >> 1) + (kOneAsInteger >> 1);
- return AsFloat(i);
-}
-
-
-inline float inline_sqrt(float x) {
- float y;
- y = inline_quick_sqrt(x);
- y = (y * y + x) / (2.0f * y);
- y = (y * y + x) / (2.0f * y);
- return y;
-}
-
-
-// This is the meat of the ray tracer. Given a pixel span (x0, x1) on
-// scanline y, shoot rays into the scene and render what they hit. Use
-// scanline coherence to do a few optimizations
-void Planet::wRenderPixelSpan(int x0, int x1, int y) {
- const int kColorBlack = MakeRGBA(0, 0, 0, 0xFF);
- float y0 = eye_y_;
- float z0 = eye_z_;
- float y1 = (static_cast<float>(y) / surface_.height) * 2.0f - 1.0f;
- float z1 = 0.0f;
- float dy = (y1 - y0);
- float dz = (z1 - z0);
- float dy_dy_dz_dz = dy * dy + dz * dz;
- float two_dy_y0_y_two_dz_z0_z = 2.0f * dy * (y0 - planet_y_) +
- 2.0f * dz * (z0 - planet_z_);
- float planet_xyz_eye_xyz = planet_xyz_ + eye_xyz_;
- float y_y0_z_z0 = planet_y_ * y0 + planet_z_ * z0;
- float oowidth = 1.0f / surface_.width;
- uint32_t *pixels = this->wGetAddr(x0, y);
- for (int x = x0; x <= x1; ++x) {
- // scan normalized screen -1..1
- float x1 = (static_cast<float>(x) * oowidth) * 2.0f - 1.0f;
- // eye
- float x0 = eye_x_;
- // delta from screen to eye
- float dx = (x1 - x0);
- // build a, b, c
- float a = dx * dx + dy_dy_dz_dz;
- float b = 2.0f * dx * (x0 - planet_x_) + two_dy_y0_y_two_dz_z0_z;
- float c = planet_xyz_eye_xyz +
- -2.0f * (planet_x_ * x0 + y_y0_z_z0) - (planet_radius2_);
- // calculate discriminant
- float disc = b * b - 4.0f * a * c;
-
- // did ray hit the sphere?
- if (disc < 0.0f) {
- *pixels = kColorBlack;
- ++pixels;
- continue;
- }
-
- // calc parametric t value
- float t = (-b - inline_sqrt(disc)) / (2.0f * a);
- float px = x0 + t * dx;
- float py = y0 + t * dy;
- float pz = z0 + t * dz;
- float nx = (px - planet_x_) * planet_one_over_radius_;
- float ny = (py - planet_y_) * planet_one_over_radius_;
- float nz = (pz - planet_z_) * planet_one_over_radius_;
-
- float Lx = (light_x_ - px);
- float Ly = (light_y_ - py);
- float Lz = (light_z_ - pz);
- float Lq = 1.0f / inline_quick_sqrt(Lx * Lx + Ly * Ly + Lz * Lz);
- Lx *= Lq;
- Ly *= Lq;
- Lz *= Lq;
- float d = (Lx * nx + Ly * ny + Lz * nz);
- float pr = (diffuse_r_ * d) + ambient_r_;
- float pg = (diffuse_g_ * d) + ambient_g_;
- float pb = (diffuse_b_ * d) + ambient_b_;
- float ds = -(nx * planet_pole_x_ +
- ny * planet_pole_y_ +
- nz * planet_pole_z_);
- float ang = acos_.TableLerp(ds);
- float v = ang * kOneOverPI;
- float dp = planet_equator_x_ * nx +
- planet_equator_y_ * ny +
- planet_equator_z_ * nz;
- float w = dp / sin(ang);
- if (w > 1.0f) w = 1.0f;
- if (w < -1.0f) w = -1.0f;
- float th = acos_.TableLerp(w) * kOneOver2PI;
- float dps = planet_pole_x_equator_x_ * nx +
- planet_pole_x_equator_y_ * ny +
- planet_pole_x_equator_z_ * nz;
- float u;
- if (dps < 0.0f)
- u = th;
- else
- u = 1.0f - th;
-
- int tx = static_cast<int>(u * tex_->width);
- int ty = static_cast<int>(v * tex_->height);
- int offset = tx + ty * tex_->width;
- uint32_t texel = tex_->pixels[offset];
- float tr = ExtractR(texel);
- float tg = ExtractG(texel);
- float tb = ExtractB(texel);
-
- unsigned int ir = Clamp255(pr * tr);
- unsigned int ig = Clamp255(pg * tg);
- unsigned int ib = Clamp255(pb * tb);
- unsigned int color = MakeRGBA(ir, ig, ib, 0xFF);
-
- *pixels = color;
- ++pixels;
- }
-}
-
-
-// Renders a rectangular area of the screen, scan line at a time
-void Planet::wRenderRect(int x, int y, int w, int h) {
- for (int j = y; j < (y + h); ++j) {
- this->wRenderPixelSpan(x, x + w - 1, j);
- }
-}
-
-
-// Thread entry point Planet::wWorkerThread()
-// This is the main loop for the worker thread(s). It waits for work
-// by testing a semaphore, which will sleep this thread until work arrives.
-// It then grabs a mutex protected counter (which is also decremented)
-// and uses this value to determine which subregion this thread should be
-// processing. When rendering is finished the worker then pings the main
-// thread via PostDone() semaphore.
-// If multithreading, this function is only called by the worker threads.
-void Planet::wWorkerThreadEntry() {
-
- // we're a 'detached' thread...
- // (so we should automagically die when the main thread exits)
- while (!exiting_) {
- // wait for some work
- workers_->WaitWork();
-
- // if main thread is exiting, have worker exit too
- if (exiting_) break;
- // okay, grab region to work on from worker counter
- int region = workers_->DecCounter();
- if (region < 0) {
- // This indicates we're not sync'ing properly
- InfoPrintf("Region value went negative!\n");
- exit(-1);
- }
- // convert region # into x0, y0, x1, y1 rectangle
- int x, y, w, h;
- this->wMakeRect(region, &x, &y, &w, &h);
-
- // render this rectangle
- this->wRenderRect(x, y, w, h);
-
- // let main thread know we've finished a region
- workers_->PostDone();
- }
-}
-
-
-// Entry point for worker thread. (Can't really pass a member function to
-// pthread_create(), so we have to do this little round-about)
-// If multithreading, this function is only called by the worker threads.
-void* wWorkerThreadEntry(void *args) {
- // unpack this pointer
- Planet *pPlanet = reinterpret_cast<Planet*>(args);
- pPlanet->wWorkerThreadEntry();
- return NULL;
-}
-
-
-// Create worker threads and pass along our this pointer.
-// If workers_ is NULL, we're running in non-threaded mode.
-bool Planet::CreateWorkerThreads(int num) {
- if (NULL != workers_) {
- return workers_->CreateThreadPool(num, ::wWorkerThreadEntry, this);
- } else {
- return true;
- }
-}
-
-
-// Run a simple sim to spin the planet. Update loop is run once per frame.
-// Called from the main thread only and only when the worker threads are idle.
-void Planet::UpdateSim() {
- float m = planet_spin_ + 0.01f;
- // keep in nice range
- if (m > (kPI * 2.0f))
- m = m - kPI * 2.0f;
- SetPlanetSpin(m);
-}
-
-
-// This is the main thread's entry point to dispatch rendering of the planet.
-// First, it sets the region counter to its max value. This mutex guarded
-// counter is how worker threads determine which region of the diagram they
-// should be working on. Then it pings the PostWork semaphore multiple times
-// to wake up the sleeping worker threads.
-void Planet::ParallelRender() {
-
- // At this point, all worker threads are idle and sleeping
-
- // setup barrier counter before we wake workers
- workers_->SetCounter(num_regions_);
- rendering_ = true;
-
- // wake up the workers
- for (int i = 0; i < num_regions_; ++i) {
- workers_->PostWork();
- }
- // At this point, all worker threads are awake and busy grabbing
- // work assignments by reading and decrementing the counter.
-}
-
-
-// ParallelRenderSync will sleep a little by waiting for the workers to
-// finish. It does that by waiting on the WaitDone semaphore.
-void Planet::ParallelRenderSync() {
-
- // Only wait if rendering is in progress.
- if (rendering_) {
- // wait for all work to be done
- for (int i = 0; i < num_regions_; ++i) {
- workers_->WaitDone();
- }
- // verify that our counter is where we expect it to be
- int c = workers_->DecCounter();
- if (-1 != c) {
- InfoPrintf("We're not syncing correctly! (%d)\n", c);
- exit(-1);
- }
- rendering_ = false;
- }
- // At this point, all worker threads are idle and sleeping again.
- // The main thread is free to muck with shared data, such
- // as updating the earth spin in the sim routine.
-}
-
-
-// Performs all rendering from the main thread.
-void Planet::SequentialRender() {
- this->wRenderRect(0, 0, surface_.width, surface_.height);
-}
-
-
-// Renders the Planet diagram.
-// Picks either parallel or sequential rendering implementation.
-void Planet::Render() {
- if (NULL == workers_) {
- this->SequentialRender();
- } else {
- this->ParallelRender();
- }
-}
-
-
-// Waits for a rendering to complete.
-void Planet::Sync() {
- if (NULL != workers_) {
- this->ParallelRenderSync();
- }
-}
-
-
-// pre-calculations to make inner loops faster
-// these need to be recalculated when values change
-void Planet::CacheCalcs() {
- planet_xyz_ = planet_x_ * planet_x_ +
- planet_y_ * planet_y_ +
- planet_z_ * planet_z_;
- planet_radius2_ = planet_radius_ * planet_radius_;
- planet_one_over_radius_ = 1.0f / planet_radius_;
- eye_xyz_ = eye_x_ * eye_x_ + eye_y_ * eye_y_ + eye_z_ * eye_z_;
- // spin vector from center->equator
- planet_equator_x_ = cos(planet_spin_);
- planet_equator_y_ = 0.0f;
- planet_equator_z_ = sin(planet_spin_);
- // cache cross product of pole & equator
- planet_pole_x_equator_x_ = planet_pole_y_ * planet_equator_z_ -
- planet_pole_z_ * planet_equator_y_;
- planet_pole_x_equator_y_ = planet_pole_z_ * planet_equator_x_ -
- planet_pole_x_ * planet_equator_z_;
- planet_pole_x_equator_z_ = planet_pole_x_ * planet_equator_y_ -
- planet_pole_y_ * planet_equator_x_;
-}
-
-
-void Planet::SetPlanetXYZR(float x, float y, float z, float r) {
- planet_x_ = x;
- planet_y_ = y;
- planet_z_ = z;
- planet_radius_ = r;
- CacheCalcs();
-}
-
-
-void Planet::SetEyeXYZ(float x, float y, float z) {
- eye_x_ = x;
- eye_y_ = y;
- eye_z_ = z;
- CacheCalcs();
-}
-
-
-void Planet::SetLightXYZ(float x, float y, float z) {
- light_x_ = x;
- light_y_ = y;
- light_z_ = z;
- CacheCalcs();
-}
-
-
-void Planet::SetAmbientRGB(float r, float g, float b) {
- ambient_r_ = r;
- ambient_g_ = g;
- ambient_b_ = b;
- CacheCalcs();
-}
-
-
-void Planet::SetDiffuseRGB(float r, float g, float b) {
- diffuse_r_ = r;
- diffuse_g_ = g;
- diffuse_b_ = b;
- CacheCalcs();
-}
-
-
-void Planet::SetPlanetPole(float x, float y, float z) {
- planet_pole_x_ = x;
- planet_pole_y_ = y;
- planet_pole_z_ = z;
- CacheCalcs();
-}
-
-
-void Planet::SetPlanetEquator(float x, float y, float z) {
- // this is really over-ridden by spin at the momenent
- planet_equator_x_ = x;
- planet_equator_y_ = y;
- planet_equator_z_ = z;
- CacheCalcs();
-}
-
-
-void Planet::SetPlanetSpin(float a) {
- planet_spin_ = a;
- CacheCalcs();
-}
-
-
-void Planet::SetSurface(Surface surface) {
- surface_ = surface;
-}
-
-
-// Setups and initializes planet data structures.
-// Seed planet, eye, and light
-Planet::Planet(int numRegions, bool multi, Texture *tex) :
- planet_radius_(1.0f),
- planet_spin_(0.0f),
- planet_x_(0.0f),
- planet_y_(0.0f),
- planet_z_(0.0f),
- planet_pole_x_(0.0f),
- planet_pole_y_(0.0f),
- planet_pole_z_(0.0f),
- planet_equator_x_(0.0f),
- planet_equator_y_(0.0f),
- planet_equator_z_(0.0f),
- eye_x_(0.0f),
- eye_y_(0.0f),
- eye_z_(0.0f),
- light_x_(0.0f),
- light_y_(0.0f),
- light_z_(0.0f),
- diffuse_r_(0.0f),
- diffuse_g_(0.0f),
- diffuse_b_(0.0f),
- ambient_r_(0.0f),
- ambient_g_(0.0f),
- ambient_b_(0.0f),
- planet_xyz_(0.0f),
- planet_pole_x_equator_x_(0.0f),
- planet_pole_x_equator_y_(0.0f),
- planet_pole_x_equator_z_(0.0f),
- planet_radius2_(0.0f),
- planet_one_over_radius_(0.0f),
- eye_xyz_(0.0f),
- surface_(NULL, 0, 0) {
- num_regions_ = numRegions;
- workers_ = multi ? new WorkerThreadManager() : NULL;
- tex_ = tex;
- exiting_ = false;
- rendering_ = false;
-
- this->SetPlanetXYZR(0.0f, 0.0f, 48.0f, 4.0f);
- this->SetEyeXYZ(0.0f, 0.0f, -14.0f);
- this->SetLightXYZ(-8.0f, -4.0f, 2.0f);
- this->SetAmbientRGB(0.4f, 0.4f, 0.4f);
- this->SetDiffuseRGB(0.8f, 0.8f, 0.8f);
- this->SetPlanetPole(0.0f, 1.0f, 0.0f);
- this->SetPlanetEquator(1.0f, 0.0f, 0.0f);
- this->SetPlanetSpin(kPI / 2.0f);
-}
-
-
-// Frees up planet resources.
-Planet::~Planet() {
- if (workers_) {
- exiting_ = true;
- // wake up the worker threads from their slumber
- workers_->PostWorkAll();
- workers_->JoinAll();
- delete workers_;
- }
-}
-
-
-// Clamps input to the max we can realistically support.
-static int ClampThreads(int num) {
- const int max = 128;
- if (num > max) {
- return max;
- }
- return num;
-}
-
-
-static void PrintCredits() {
- static const char *credit =
- "\n"
- "Image Credit:\n"
- "\n"
- "NASA Goddard Space Flight Center Image by Reto Stöckli (land surface,\n"
- "shallow water, clouds). Enhancements by Robert Simmon (ocean color,\n"
- "compositing, 3D globes, animation).\n"
- "Data and technical support: MODIS Land Group; MODIS Science Data,\n"
- "Support Team; MODIS Atmosphere Group; MODIS Ocean Group\n"
- "Additional data:\n"
- "USGS EROS Data Center (topography); USGS Terrestrial Remote Sensing\n"
- "Flagstaff Field Center (Antarctica); Defense Meteorological\n"
- "Satellite Program (city lights).\n"
- "\n";
- InfoPrintf(credit);
-}
-
-// If user specifies options on cmd line, parse them
-// here and update global settings as needed.
-static void ParseCmdLineArgs(int argc, const char *argn[], const char *argv[]) {
- // look for cmd line args
- PrintCredits();
- if (argc > 1) {
- for (int i = 1; i < argc; ++i) {
- if (argn[i] == strstr(argn[i], "numthreads")) {
- int numthreads = atoi(argv[i]);
- if (numthreads > 1) {
- g_multi_threading = true;
- g_num_threads = numthreads;
- g_num_regions = numthreads * kRegionRatio;
- InfoPrintf("Using %d threads\n", numthreads);
- } else {
- InfoPrintf("Could not parse numthreads=%s.\n", argv[i]);
- }
- } else if (argn[i] == strstr(argn[i], "usesysconf")) {
- if (argv[i] == strstr(argv[i], "true")) {
- g_multi_threading = true;
- g_ask_sysconf = true;
- } else if (argv[i] == strstr(argv[i], "false")) {
- g_multi_threading = false;
- } else {
- InfoPrintf("Could not parse usesysconf=%s.\n", argv[i]);
- }
- } else if (argn[i] == strstr(argn[i], "xwidth")) {
- int w = atoi(argv[i]);
- if ((w > 0) && (w < kMaxWindow)) g_window_width = w;
- } else if (argn[i] == strstr(argn[i], "xheight")) {
- int h = atoi(argv[i]);
- if ((h > 0) && (h < kMaxWindow)) g_window_height = h;
- } else if (argn[i] == strstr(argn[i], "frames")) {
- int f = atoi(argv[i]);
- if ((f > 0) && (f < kMaxFrames)) g_num_frames = f;
- } else if (argn[i] == strstr(argn[i], "id")) {
- /* ignore id */
- } else if (argn[i] == strstr(argn[i], "src")) {
- /* ignore src */
- } else if (argn[i] == strstr(argn[i], "style")) {
- /* ignore style */
- } else if (argn[i] == strstr(argn[i], "type")) {
- /* ignore type */
- } else {
- if (argn[i] != strstr(argn[i], "help")) {
- InfoPrintf("unknown option %s=%s\n", argn[i], argv[i]);
- }
- InfoPrintf("Earth Pepper Demo\n"
- "usage: numthreads=\"n\" render using n threads.\n"
- " usesysconf=true use sysconf to set thread count."
- "\n"
- " xwidth=\"w\" width of window.\n"
- " xheight=\"h\" height of window.\n"
- " framecount=\"n\" number of frames.\n"
- " help show this screen.\n");
- }
- }
- }
-
- InfoPrintf("Multi-threading %s.\n",
- g_multi_threading ? "enabled" : "disabled");
-
- // see if the system can tell us # cpus
- if ((g_ask_sysconf) && (g_multi_threading)) {
- int ncpu = sysconf(_SC_NPROCESSORS_ONLN);
- if (ncpu > 1) {
- InfoPrintf("Using %d processors based on sysconf.\n", ncpu);
- g_num_threads = ncpu;
- g_num_regions = ncpu * kRegionRatio;
- }
- }
-
- // clamp threads and regions
- g_num_threads = ClampThreads(g_num_threads);
- g_num_regions = ClampThreads(g_num_regions);
-}
-
-Planet *g_planet = NULL;
-
-// Parses cmd line options, initializes surface, runs the demo & shuts down.
-extern "C" void Earth_Init(int argc, const char *argn[], const char *argv[]) {
- ParseCmdLineArgs(argc, argn, argv);
- g_planet = new Planet(g_num_regions, g_multi_threading, &g_earth);
- if (!g_planet->CreateWorkerThreads(g_num_threads)) {
- DebugPrintf("Earth_Init: thread creation failed. g_num_threads: %d\n",
- g_num_threads);
- exit(-1);
- }
-}
-
-extern "C" void Earth_Draw(uint32_t *image_data, int width, int height) {
- g_planet->SetSurface(Surface(image_data, width, height));
- g_planet->UpdateSim();
- g_planet->Render();
-}
-
-extern "C" void Earth_Sync() {
- g_planet->Sync();
- g_planet->SetSurface(Surface(NULL, 0, 0));
-}
diff --git a/ppapi/native_client/tests/earth/earth.h b/ppapi/native_client/tests/earth/earth.h
deleted file mode 100644
index c24150c..0000000
--- a/ppapi/native_client/tests/earth/earth.h
+++ /dev/null
@@ -1,26 +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.
- */
-#ifndef NATIVE_CLIENT_TESTS_EARTH_EARTH_H_
-#define NATIVE_CLIENT_TESTS_EARTH_EARTH_H_
-
-#include <stdint.h>
-#include <string.h>
-
-/* NaCl Earth demo */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void DebugPrintf(const char *fmt, ...);
-void Earth_Init(int argcount, const char *argname[], const char *argvalue[]);
-void Earth_Draw(uint32_t* image_data, int width, int height);
-void Earth_Sync();
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* NATIVE_CLIENT_TESTS_EARTH_EARTH_H_ */
diff --git a/ppapi/native_client/tests/earth/earth_c.html b/ppapi/native_client/tests/earth/earth_c.html
deleted file mode 100644
index 52c7216..0000000
--- a/ppapi/native_client/tests/earth/earth_c.html
+++ /dev/null
@@ -1,57 +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="application/x-javascript">
- //<![CDATA[
-function setupTests(tester, plugin) {
- tester.addAsyncTest('smoke', function(status) {
- status.setTimeout(function() {
- // '' means there was no error.
- status.assertEqual(plugin.lastError, '');
- status.pass(); // Async tests require an explicit pass.
- }, 2000);
- });
-}
- //]]>
- </script>
- <title>Native Client Rotating Globe</title>
-</head>
-
-<body>
-
-<h1>Native Client Rotating Globe - C</h1>
- <p>
- Image Credit:
- NASA Goddard Space Flight Center Image by Reto Stöckli (land surface,
- shallow water, clouds). Enhancements by Robert Simmon (ocean color,
- compositing, 3D globes, animation).
- Data and technical support: MODIS Land Group; MODIS Science Data,
- Support Team; MODIS Atmosphere Group; MODIS Ocean Group Additional data:
- USGS EROS Data Center (topography); USGS Terrestrial Remote Sensing
- Flagstaff Field Center (Antarctica); Defense Meteorological
- Satellite Program (city lights).
- </p>
-
-<embed name="nacl_module_c"
- id="earth_c_nexe"
- width=512 height=512
- src="earth_c.nmf"
- type="application/x-nacl"
- usesysconf="true">
-
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- setupTests(tester, $('earth_c_nexe'));
- tester.waitFor($('earth_c_nexe'));
- tester.run();
- //]]>
- </script>
-
-</body>
-</html>
diff --git a/ppapi/native_client/tests/earth/earth_c.nmf.dsoexample b/ppapi/native_client/tests/earth/earth_c.nmf.dsoexample
deleted file mode 100644
index aec9f91..0000000
--- a/ppapi/native_client/tests/earth/earth_c.nmf.dsoexample
+++ /dev/null
@@ -1,30 +0,0 @@
-// This file is an example of a working manifest file for the earth_c
-// example. Note that the library names, including the eight-digit version
-// number, must match the libraries available to the application.
-//
-// At the time this file was committed, the earth example was broken due to
-// this issue: http://code.google.com/p/nativeclient/issues/detail?id=2202
-// As a work around, specify 'usesysconf="false"' in the HTML file.
-{
- "program": {
- "x86-32": {"url": "lib/runnable-ld.so"},
- "x86-64": {"url": "lib/runnable-ld.so"},
- "arm": {"url": "lib/runnable-ld.so"}
- },
- "files": {
- "lib/runnable-ld.so" : { "x86-32" : { "url": "lib/runnable-ld.so"}},
- "lib/libc.so.b0c62cad" : { "x86-32" : { "url": "lib/libc.so.b0c62cad"}},
- "lib/libm.so.b0c62cad" : { "x86-32" : { "url": "lib/libm.so.b0c62cad"}},
- "lib/libgcc_s.so.1" : { "x86-32" : { "url": "lib/libgcc_s.so.1"}},
- "lib/libpthread.so.b0c62cad" :
- { "x86-32" : { "url": "lib/libpthread.so.b0c62cad"}},
- "lib/libstdc++.so.6" : { "x86-32" : { "url": "lib/libstdc++.so.6"}},
- "lib/libplatform.so" : { "x86-32" : { "url": "lib/libplatform.so"}},
- "lib/libgio.so" : { "x86-32" : { "url": "lib/libgio.so"}},
- "main.nexe": {
- "x86-32": {"url": "earth_c_x86-32.nexe"},
- "x86-64": {"url": "earth_c_x86-64.nexe"},
- "arm": {"url": "earth_c_arm.nexe"}
- }
- }
-}
diff --git a/ppapi/native_client/tests/earth/earth_cc.html b/ppapi/native_client/tests/earth/earth_cc.html
deleted file mode 100644
index ab20ff4..0000000
--- a/ppapi/native_client/tests/earth/earth_cc.html
+++ /dev/null
@@ -1,58 +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="application/x-javascript">
- //<![CDATA[
-function setupTests(tester, plugin) {
- tester.addAsyncTest('smoke', function(status) {
- status.setTimeout(function() {
- // '' means there was no error.
- status.assertEqual(plugin.lastError, '');
- status.pass(); // Async tests require an explicit pass.
- }, 2000);
- });
-}
- //]]>
- </script>
- <title>Native Client Rotating Globe</title>
-</head>
-
-<body>
-
-<h1>Native Client Rotating Globe - C++</h1>
- <p>
- Image Credit:
- NASA Goddard Space Flight Center Image by Reto Stöckli (land surface,
- shallow water, clouds). Enhancements by Robert Simmon (ocean color,
- compositing, 3D globes, animation).
- Data and technical support: MODIS Land Group; MODIS Science Data,
- Support Team; MODIS Atmosphere Group; MODIS Ocean Group Additional data:
- USGS EROS Data Center (topography); USGS Terrestrial Remote Sensing
- Flagstaff Field Center (Antarctica); Defense Meteorological
- Satellite Program (city lights).
- </p>
-
-<embed name="nacl_module_c"
- id="earth_cc_nexe"
- width=512 height=512
- src="earth_cc.nmf"
- type="application/x-nacl"
- usesysconf="true">
-
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- setupTests(tester, $('earth_cc_nexe'));
- tester.waitFor($('earth_cc_nexe'));
- tester.run();
- //]]>
- </script>
-
-</body>
-</html>
-
diff --git a/ppapi/native_client/tests/earth/nacl.scons b/ppapi/native_client/tests/earth/nacl.scons
deleted file mode 100644
index fec9429..0000000
--- a/ppapi/native_client/tests/earth/nacl.scons
+++ /dev/null
@@ -1,77 +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.
-
-Import('env')
-
-if (not env.Bit('bitcode')):
- flags = ['-mfpmath=sse', '-msse2', '-O3', '-ffast-math',
- '-fomit-frame-pointer']
- env.Append(CCFLAGS=flags)
- env.Append(CXXFLAGS=flags)
-
-earthlib = env.ComponentLibrary('earthlib', ['earth.cc'])
-
-# build, C then C++
-cobj=['pepper_c.c']
-c_nexe_name = env.ProgramNameForNmf('earth_c')
-cnexe = env.ComponentProgram(c_nexe_name, cobj,
- EXTRA_LIBS=['earthlib',
- 'ppapi',
- 'm', 'pthread'])
-env.Publish(c_nexe_name, 'run', ['earth_c.html'])
-
-node = env.DemoSelLdrNacl('demo_earth_c', cnexe, args=[])
-# Note: Make this available from top level
-Alias('demo_earth_c', node)
-
-ccobj=['pepper_cc.cc']
-cc_nexe_name = env.ProgramNameForNmf('earth_cc')
-ccnexe = env.ComponentProgram(cc_nexe_name, ccobj,
- EXTRA_LIBS=['earthlib',
- 'ppapi_cpp',
- 'm', 'pthread'])
-env.Publish(cc_nexe_name, 'run', ['earth_cc.html'])
-
-node = env.DemoSelLdrNacl('demo_earth_cc', ccnexe, args=[])
-# Note: Make this available from top level
-Alias('demo_earth_cc', node)
-
-
-# Validator tests, C then C++, but not for glibc
-# TODO(bradchen): enable these tests when ncval works with glibc DSOs
-if not env.Bit('nacl_glibc'):
- node = env.CommandValidatorTestNacl(
- 'earth_test_val_c.out',
- image=[cnexe],
- )
- env.AddNodeToTestSuite(node, ['validator_tests', 'small_tests'],
- 'run_earth_c')
- node = env.CommandValidatorTestNacl(
- 'earth_test_val_cc.out',
- image=[ccnexe],
- )
- env.AddNodeToTestSuite(node, ['validator_tests', 'small_tests'],
- 'run_earth_cc')
-
-
-# browser tests, C then C++
-
-node = env.PPAPIBrowserTester(
- 'earth_browser_test_c.out',
- url='earth_c.html',
- nmf_names=['earth_c'],
- files=env.ExtractPublishedFiles(c_nexe_name),
- is_broken=env.PPAPIBrowserTesterIsBroken())
-
-env.AddNodeToTestSuite(node, ['chrome_browser_tests'], 'earth_browser_test_c')
-
-node = env.PPAPIBrowserTester(
- 'earth_browser_test_cc.out',
- url='earth_cc.html',
- nmf_names=['earth_cc'],
- files=env.ExtractPublishedFiles(cc_nexe_name),
- is_broken=env.PPAPIBrowserTesterIsBroken())
-
-env.AddNodeToTestSuite(node, ['chrome_browser_tests'], 'earth_browser_test_cc')
diff --git a/ppapi/native_client/tests/earth/pepper_c.c b/ppapi/native_client/tests/earth/pepper_c.c
deleted file mode 100644
index 98d347c..0000000
--- a/ppapi/native_client/tests/earth/pepper_c.c
+++ /dev/null
@@ -1,229 +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.
- */
-
-/* NaCl Earth demo */
-/* Pepper code in C */
-
-#include "native_client/tests/earth/earth.h"
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-
-/* Pepper includes */
-#include "ppapi/c/pp_completion_callback.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_module.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_view.h"
-#include "ppapi/c/ppp.h"
-#include "ppapi/c/ppp_instance.h"
-
-#define NUMBER_OF_IMAGES 2
-
-PPB_GetInterface g_get_browser_interface = NULL;
-
-/* NOTE on PP_Instance: In general Pepper is designed such that a
- * single plugin process can implement multiple plugin instances.
- * This might occur, for example, if a plugin were instantiated by
- * multiple <embed ...> tags in a single page.
- *
- * This implementation assumes at most one instance per plugin,
- * consistent with limitations of the current implementation of
- * Native Client.
- */
-struct PepperState {
- const PPB_Core* core_interface;
- const PPB_Graphics2D* graphics_2d_interface;
- const PPB_ImageData* image_data_interface;
- const PPB_Instance* instance_interface;
- const PPB_View* view_interface;
- PP_Resource device_context;
- int32_t which_image;
- PP_Resource image[NUMBER_OF_IMAGES];
- uint32_t* image_data[NUMBER_OF_IMAGES];
- PP_Instance instance;
- struct PP_Rect position;
- bool ready;
-};
-struct PepperState g_MyState;
-bool g_MyStateIsValid = false;
-
-static void Repaint(struct PepperState *mystate);
-static void FlushCompletionCallback(void* user_data, int32_t result) {
- Repaint((struct PepperState*)user_data);
-}
-
-static void Repaint(struct PepperState *mystate) {
- struct PP_Point topleft = PP_MakePoint(0, 0);
- struct PP_Rect rect = PP_MakeRectFromXYWH(0, 0,
- mystate->position.size.width,
- mystate->position.size.height);
- int show, render;
-
- /* Wait for previous rendering (if applicable) to finish */
- Earth_Sync();
-
- /* Double buffer - show previously rendered image. */
- show = mystate->which_image;
- mystate->graphics_2d_interface->PaintImageData(mystate->device_context,
- mystate->image[show],
- &topleft, &rect);
- int32_t ret;
- ret = mystate->graphics_2d_interface->Flush(mystate->device_context,
- PP_MakeCompletionCallback(&FlushCompletionCallback, mystate));
-
- /* Start Rendering into the other image while presenting. */
- render = (mystate->which_image + 1) % NUMBER_OF_IMAGES;
-
- Earth_Draw(mystate->image_data[render],
- mystate->position.size.width,
- mystate->position.size.height);
-
- /* In next callback, show what was rendered. */
- mystate->which_image = render;
-}
-
-static PP_Bool Instance_DidCreate(PP_Instance instance,
- uint32_t argc,
- const char* argn[],
- const char* argv[]) {
- assert(g_MyStateIsValid == false);
-
- DebugPrintf("Creating instance %x\n", instance);
- g_MyState.instance = instance;
- g_MyState.ready = false;
- g_MyStateIsValid = true;
-
- Earth_Init(argc, argn, argv);
- return PP_TRUE;
-}
-
-static void Instance_DidDestroy(PP_Instance instance) {
- assert(g_MyState.instance == instance && g_MyStateIsValid == true);
- g_MyStateIsValid = false;
-}
-
-/* Returns a refed resource corresponding to the created device context. */
-static PP_Resource MakeAndBindDeviceContext(PP_Instance instance,
- const struct PP_Size* size) {
- PP_Resource device_context;
-
- device_context =
- g_MyState.graphics_2d_interface->Create(instance, size, PP_FALSE);
- if (!device_context) return 0;
-
- if (!g_MyState.instance_interface->BindGraphics(instance, device_context)) {
- g_MyState.core_interface->ReleaseResource(device_context);
- return 0;
- }
- return device_context;
-}
-
-static void Instance_DidChangeView(PP_Instance pp_instance,
- PP_Resource pp_view) {
- DebugPrintf("DidChangeView(%x)\n", pp_instance);
- assert(g_MyStateIsValid == true);
- assert(g_MyState.instance == pp_instance);
-
- g_MyState.view_interface->GetRect(pp_view, &g_MyState.position);
- if (g_MyState.ready == false) {
- g_MyState.device_context =
- MakeAndBindDeviceContext(pp_instance, &g_MyState.position.size);
- /* create device context */
- if (!g_MyState.device_context) {
- DebugPrintf("device_context is null!\n");
- return;
- }
- /*
- * Create double-buffered image data.
- * Note: This example does not use transparent pixels. All pixels are
- * written into the framebuffer with alpha set to 255 (opaque)
- * Note: Pepper uses premultiplied alpha.
- */
- g_MyState.which_image = 0;
- for (int i = 0; i < NUMBER_OF_IMAGES; ++i) {
- g_MyState.image[i] =
- g_MyState.image_data_interface->Create(pp_instance,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL, &g_MyState.position.size, PP_TRUE);
- if (!g_MyState.image[i]) {
- DebugPrintf("image resource is invalid!\n");
- return;
- }
- g_MyState.image_data[i] =
- (uint32_t*)g_MyState.image_data_interface->Map(g_MyState.image[i]);
- if (!g_MyState.image_data[i]) {
- DebugPrintf("could not allocate image_data\n");
- return;
- }
- size_t size_in_bytes = g_MyState.position.size.width *
- g_MyState.position.size.height * sizeof(uint32_t);
- memset(g_MyState.image_data[i], 0, size_in_bytes);
- }
- g_MyState.ready = true;
- Repaint(&g_MyState);
- }
-}
-
-static void Instance_DidChangeFocus(PP_Instance pp_instance,
- PP_Bool has_focus) {
-}
-
-static PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance,
- PP_Resource pp_url_loader) {
- return PP_FALSE;
-}
-
-static PPP_Instance instance_interface = {
- &Instance_DidCreate,
- &Instance_DidDestroy,
- &Instance_DidChangeView,
- &Instance_DidChangeFocus,
- &Instance_HandleDocumentLoad
-};
-
-
-/* Global entrypoints --------------------------------------------------------*/
-
-PP_EXPORT int32_t PPP_InitializeModule(PP_Module module,
- PPB_GetInterface get_browser_interface) {
- g_get_browser_interface = get_browser_interface;
-
- g_MyState.core_interface = (const PPB_Core*)
- get_browser_interface(PPB_CORE_INTERFACE);
- g_MyState.instance_interface = (const PPB_Instance*)
- get_browser_interface(PPB_INSTANCE_INTERFACE);
- g_MyState.image_data_interface = (const PPB_ImageData*)
- get_browser_interface(PPB_IMAGEDATA_INTERFACE);
- g_MyState.graphics_2d_interface = (const PPB_Graphics2D*)
- get_browser_interface(PPB_GRAPHICS_2D_INTERFACE);
- g_MyState.view_interface = (const PPB_View*)
- get_browser_interface(PPB_VIEW_INTERFACE);
- if (!g_MyState.core_interface ||
- !g_MyState.instance_interface ||
- !g_MyState.image_data_interface ||
- !g_MyState.graphics_2d_interface ||
- !g_MyState.view_interface)
- return -1;
-
- return PP_OK;
-}
-
-PP_EXPORT void PPP_ShutdownModule() {
-}
-
-PP_EXPORT const void* PPP_GetInterface(const char* interface_name) {
- if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0)
- return &instance_interface;
- return NULL;
-}
diff --git a/ppapi/native_client/tests/earth/pepper_cc.cc b/ppapi/native_client/tests/earth/pepper_cc.cc
deleted file mode 100644
index 9d8254e..0000000
--- a/ppapi/native_client/tests/earth/pepper_cc.cc
+++ /dev/null
@@ -1,127 +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.
- */
-
-// NaCl Earth demo
-// Pepper code in C++
-
-#include "native_client/tests/earth/earth.h"
-
-// Pepper includes
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/graphics_2d.h"
-#include "ppapi/cpp/image_data.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/rect.h"
-#include "ppapi/cpp/size.h"
-
-const int kNumberOfImages = 2;
-
-void RepaintCallback(void* data, int32_t result);
-
-class GlobeInstance : public pp::Instance {
- public:
- explicit GlobeInstance(PP_Instance instance) : pp::Instance(instance),
- ready_(false),
- window_width_(0),
- window_height_(0),
- which_image_(0) {
- DebugPrintf("GlobeInstance::GlobeInstance()\n");
- }
-
- virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
- Earth_Init(argc, argn, argv);
-
- return true;
- }
-
- virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip) {
- size_ = position.size();
- if (false == ready_) {
- // Create double buffered image data.
- // Note: This example does not use transparent pixels. All pixels are
- // written into the framebuffer with alpha set to 255 (opaque)
- // Note: Pepper uses premultiplied alpha.
- for (int i = 0; i < kNumberOfImages; ++i) {
- pixel_buffer_[i] = new pp::ImageData(this,
- PP_IMAGEDATAFORMAT_BGRA_PREMUL,
- size_, PP_TRUE);
- if (!pixel_buffer_[i]) {
- DebugPrintf("couldn't allocate pixel_buffer_.\n");
- return;
- }
- }
- graphics_2d_context_ = new pp::Graphics2D(this, size_, false);
- if (!BindGraphics(*graphics_2d_context_)) {
- DebugPrintf("couldn't bind the device context.\n");
- return;
- }
- ready_ = true;
- if (window_width_ != position.size().width() ||
- window_height_ != position.size().height()) {
- // Got a resize, repaint the plugin.
- window_width_ = position.size().width();
- window_height_ = position.size().height();
- Repaint();
- }
- }
- }
-
- void Repaint() {
- if (ready_ != true) return;
-
- int show = which_image_;
-
- // Wait for rendering to complete.
- Earth_Sync();
-
- // Don't use ReplaceContents; it causes the image to flicker!
- graphics_2d_context_->PaintImageData(*pixel_buffer_[show], pp::Point());
- graphics_2d_context_->Flush(pp::CompletionCallback(&RepaintCallback, this));
-
- int render = (which_image_ + 1) % kNumberOfImages;
-
- // Start rendering into other image while presenting.
- Earth_Draw(static_cast<uint32_t*>(pixel_buffer_[render]->data()),
- window_width_, window_height_);
-
- which_image_ = render;
- }
-
- private:
- bool ready_;
- int window_width_;
- int window_height_;
- int which_image_;
- pp::Size size_;
- pp::ImageData* pixel_buffer_[kNumberOfImages];
- pp::Graphics2D* graphics_2d_context_;
-};
-
-void RepaintCallback(void* data, int32_t result) {
- static_cast<GlobeInstance*>(data)->Repaint();
-}
-
-class GlobeModule : public pp::Module {
- public:
- // Override CreateInstance to create your customized Instance object.
- virtual pp::Instance* CreateInstance(PP_Instance instance) {
- return new GlobeInstance(instance);
- }
-};
-
-namespace pp {
-
-// factory function for your specialization of the Module object
-Module* CreateModule() {
- Module* mm;
- mm = new GlobeModule();
- return mm;
-}
-
-} // namespace pp
diff --git a/ppapi/native_client/tests/ppapi_example_2d/nacl.scons b/ppapi/native_client/tests/ppapi_example_2d/nacl.scons
deleted file mode 100644
index 8134f59..0000000
--- a/ppapi/native_client/tests/ppapi_example_2d/nacl.scons
+++ /dev/null
@@ -1,22 +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 is a Pepper 2D example from ppapi/examples/2d.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-
-nexe_name = env.ProgramNameForNmf('ppapi_example_2d')
-obj = env.ComponentObject(
- 'graphics_2d_example',
- '$SOURCE_ROOT/ppapi/examples/2d/graphics_2d_example.c'
- )
-ppapi_example_2d_nexe = env.ComponentProgram(nexe_name, [obj],
- EXTRA_LIBS=['ppapi'])
-
-# Note that the html is required to run this program.
-env.Publish(nexe_name, 'run',
- ['ppapi_example_2d.html', 'ppapi_example_2d.nmf' ])
diff --git a/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.html b/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.html
deleted file mode 100644
index 906ef29..0000000
--- a/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <!-- Copyright 2010 Google Inc. All rights reserved. -->
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
- <META HTTP-EQUIV="Expires" CONTENT="-1" />
- </head>
- <h1>Native Client PPAPI Graphics2D</h1>
- <body>
- <embed id="naclModule"
- name="naclModule"
- width=400 height=400
- src="ppapi_example_2d.nmf"
- style="background-color:gray"
- type="application/x-nacl" />
- <br>Resize the window for repaint to trigger.<br>
- <table>
- <tr> <td align="center"> <em> Legend </em>
- <tr> <td align="center" style="background-color:blue">Test passed
- <tr> <td align="center" style="background-color:gray">Test failed
- </table>
-
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.nmf b/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.nmf
deleted file mode 100644
index 56da2ee..0000000
--- a/ppapi/native_client/tests/ppapi_example_2d/ppapi_example_2d.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_example_2d_x86-32.nexe"},
- "x86-64": {"url": "ppapi_example_2d_x86-64.nexe"},
- "arm": {"url": "ppapi_example_2d_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_example_audio/audio.cc b/ppapi/native_client/tests/ppapi_example_audio/audio.cc
deleted file mode 100644
index 4574b30..0000000
--- a/ppapi/native_client/tests/ppapi_example_audio/audio.cc
+++ /dev/null
@@ -1,320 +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.
-//
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <cmath>
-#include <limits>
-#include <string>
-#include "native_client/src/include/nacl/nacl_inttypes.h"
-#include "native_client/src/shared/platform/nacl_log.h"
-#include "native_client/src/shared/ppapi_proxy/utility.h"
-#include "ppapi/c/pp_bool.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_audio.h"
-#include "ppapi/c/ppb_audio_config.h"
-#include "ppapi/cpp/audio.h"
-#include "ppapi/cpp/audio_config.h"
-#include "ppapi/cpp/completion_callback.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/var.h"
-
-
-// Most of this example is borrowed from ppapi/examples/audio/audio.cc
-
-// Separate left and right frequency to make sure we didn't swap L & R.
-// Sounds pretty horrible, though...
-const double kDefaultFrequencyLeft = 400.0;
-const double kDefaultFrequencyRight = 1000.0;
-const uint32_t kDefaultDuration = 10000;
-
-const double kPi = 3.141592653589;
-const double kTwoPi = 2.0 * kPi;
-
-void LogFailure(const char* msg) {
- NaClLog(LOG_ERROR, "\n*** FAILURE **** example: %s", msg);
-}
-
-class MyInstance : public pp::Instance {
- private:
- void ParseArgs(uint32_t argc, const char* argn[], const char* argv[]) {
- NaClLog(1, "example: parsing %d args\n", static_cast<int>(argc));
- for (uint32_t i = 0; i < argc; ++i) {
- NaClLog(1, "example: arg %d: [%s] [%s]\n",
- static_cast<int>(i), argn[i], argv[i]);
- const std::string tag = argn[i];
- if (tag == "frequency_l") frequency_l_ = strtod(argv[i], 0);
- if (tag == "frequency_r") frequency_r_ = strtod(argv[i], 0);
- if (tag == "amplitude_l") amplitude_l_ = strtod(argv[i], 0);
- if (tag == "amplitude_r") amplitude_r_ = strtod(argv[i], 0);
- if (tag == "duration_msec") duration_msec_ = strtod(argv[i], 0);
- if (tag == "basic_tests") basic_tests_ = (0 != atoi(argv[i]));
- if (tag == "stress_tests") stress_tests_ = (0 != atoi(argv[i]));
- if (tag == "headless") headless_ = (0 != atoi(argv[i]));
- // ignore other tags
- }
- }
-
- public:
- explicit MyInstance(PP_Instance instance)
- : pp::Instance(instance),
- config_(NULL),
- audio_(NULL),
- audio_wave_l_(0.0),
- audio_wave_r_(0.0),
- frequency_l_(kDefaultFrequencyLeft),
- frequency_r_(kDefaultFrequencyRight),
- amplitude_l_(1.0),
- amplitude_r_(1.0),
- headless_(false),
- basic_tests_(false),
- stress_tests_(false),
- duration_msec_(kDefaultDuration),
- obtained_sample_frame_count_(0),
- callback_count_(0) {}
-
- virtual void HandleMessage(const pp::Var& message) {
- NaClLog(1, "example: received HandleMessage\n");
- if (message.is_string()) {
- if (message.AsString() == "StartPlayback") {
- StartOutput();
- }
- }
- }
-
- bool HaveAudio() {
- PP_Resource audio_config_resource = config_->pp_resource();
- PP_Resource audio_resource = audio_->pp_resource();
- const int kInvalidResource = 0;
- if (audio_config_resource == kInvalidResource)
- return false;
- if (audio_resource == kInvalidResource)
- return false;
- return true;
- }
-
- void StartOutput() {
- uint32_t stop_in_msec = 0;
- if (HaveAudio()) {
- bool audio_start_playback = audio_->StartPlayback();
- CHECK(true == audio_start_playback);
- NaClLog(1, "example: frequencies are %f %f\n", frequency_l_,
- frequency_r_);
- NaClLog(1, "example: amplitudes are %f %f\n", amplitude_l_, amplitude_r_);
- NaClLog(1, "example: Scheduling StopOutput on main thread in %"
- NACL_PRIu32"msec\n", duration_msec_);
- stop_in_msec = duration_msec_;
- }
- // Schedule a callback in duration_msec_ to stop audio output
- pp::CompletionCallback cc(StopOutput, this);
- pp::Module::Get()->core()->CallOnMainThread(stop_in_msec, cc, PP_OK);
- }
-
- static void StopOutput(void* user_data, int32_t err) {
- MyInstance* instance = static_cast<MyInstance*>(user_data);
-
- const int kMaxResult = 256;
- char result[kMaxResult];
- NaClLog(1, "example: StopOutput() invoked on main thread\n");
- if (PP_OK == err) {
- // Systems without audio or run with headless option will pass.
- if (!instance->HaveAudio() || instance->headless_) {
- snprintf(result, kMaxResult, "StopOutput:PASSED");
- } else if (instance->audio_->StopPlayback()) {
- if (instance->callback_count_ >= 2) {
- snprintf(result, kMaxResult, "StopOutput:PASSED");
- } else {
- snprintf(result, kMaxResult, "StopOutput:FAILED - too "
- "few callbacks (only %d callbacks detected)",
- static_cast<int>(instance->callback_count_));
- }
- } else {
- snprintf(result, kMaxResult, "StopOutput:FAILED");
- }
- } else {
- snprintf(result, kMaxResult,
- "StopOutput: FAILED - returned err is %d", static_cast<int>(err));
- }
- // Release audio & config instance.
- delete instance->audio_;
- delete instance->config_;
- instance->audio_ = NULL;
- instance->config_ = NULL;
- // At this point the test has finished, report result.
- pp::Var message(result);
- instance->PostMessage(message);
- }
-
- // To enable basic tests, use basic_tests="1" in the embed tag.
- void BasicTests() {
- // Verify obtained_sample_frame_count isn't out of range.
- CHECK(obtained_sample_frame_count_ >= PP_AUDIOMINSAMPLEFRAMECOUNT);
- CHECK(obtained_sample_frame_count_ <= PP_AUDIOMAXSAMPLEFRAMECOUNT);
- // Do some sanity checks below; verify c & cpp interfaces agree.
- // Note: This is test code and is not normally needed for an application.
- PPB_GetInterface get_browser_interface =
- pp::Module::Get()->get_browser_interface();
- const PPB_AudioConfig* audio_config_interface =
- static_cast<const PPB_AudioConfig*>(
- get_browser_interface(PPB_AUDIO_CONFIG_INTERFACE));
- const PPB_Audio* audio_interface =
- static_cast<const PPB_Audio*>(
- get_browser_interface(PPB_AUDIO_INTERFACE));
- PP_Resource audio_config_resource = config_->pp_resource();
- PP_Resource audio_resource = audio_->pp_resource();
- NaClLog(1, "example: audio config resource: %"NACL_PRId32"\n",
- audio_config_resource);
- NaClLog(1, "example: audio resource: %"NACL_PRId32"\n", audio_resource);
- if (!HaveAudio())
- return;
- CHECK(PP_TRUE == audio_config_interface->
- IsAudioConfig(audio_config_resource));
- CHECK(PP_TRUE == audio_interface->IsAudio(audio_resource));
- CHECK(PP_FALSE == audio_config_interface->IsAudioConfig(audio_resource));
- CHECK(PP_FALSE == audio_interface->IsAudio(audio_config_resource));
- CHECK(audio_interface->GetCurrentConfig(audio_resource) ==
- audio_config_resource);
- CHECK(0 == audio_interface->GetCurrentConfig(audio_config_resource));
- CHECK(audio_config_interface->GetSampleRate(audio_config_resource) ==
- config_->sample_rate());
- CHECK(audio_config_interface->GetSampleFrameCount(audio_config_resource) ==
- config_->sample_frame_count());
- CHECK(audio_->config().pp_resource() == audio_config_resource);
- }
-
- // To enable stress tests, use stress_tests="1" in the embed tag.
- void StressTests() {
- if (!HaveAudio())
- return;
- // Attempt to create many audio devices, then immediately shut them down.
- // Chrome may generate some warnings on the console, but should not crash.
- const int kNumManyAudio = 1000;
- pp::Audio* many_audio[kNumManyAudio];
- for (int i = 0; i < kNumManyAudio; ++i)
- many_audio[i] = new pp::Audio(this, *config_, SilenceCallback, this);
- for (int i = 0; i < kNumManyAudio; ++i)
- CHECK(true == many_audio[i]->StartPlayback());
- for (int i = 0; i < kNumManyAudio; ++i)
- delete many_audio[i];
- }
-
- void TestSuite() {
- if (basic_tests_)
- BasicTests();
- if (stress_tests_)
- StressTests();
- }
-
- virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
- const int32_t kSampleFrameCount = 2048;
- ParseArgs(argc, argn, argv);
- obtained_sample_rate_ = pp::AudioConfig::RecommendSampleRate(this);
- obtained_sample_frame_count_ = pp::AudioConfig::RecommendSampleFrameCount(
- this, obtained_sample_rate_, kSampleFrameCount);
- config_ = new pp::AudioConfig(
- this, obtained_sample_rate_, obtained_sample_frame_count_);
- CHECK(NULL != config_);
- audio_ = new pp::Audio(this, *config_, SineWaveCallback, this);
- CHECK(NULL != audio_);
- // Run through test suite before attempting real playback.
- TestSuite();
- return true;
- }
-
- private:
- static void SineWaveCallback(void* samples, uint32_t num_bytes, void* thiz) {
- MyInstance* instance = reinterpret_cast<MyInstance*>(thiz);
- const double delta_l = kTwoPi * instance->frequency_l_ /
- instance->obtained_sample_rate_;
- const double delta_r = kTwoPi * instance->frequency_r_ /
- instance->obtained_sample_rate_;
-
- // Verify num_bytes and obtained_sample_frame_count match up.
- const int kNumChannelsForStereo = 2;
- const int kSizeOfSample = sizeof(int16_t);
- const size_t single_sample = kNumChannelsForStereo * kSizeOfSample;
-
- // CHECK inside callback is only for testing purposes.
- CHECK(instance->obtained_sample_frame_count_ * single_sample == num_bytes);
-
- // Use per channel audio wave value to avoid clicks on buffer boundries.
- double wave_l = instance->audio_wave_l_;
- double wave_r = instance->audio_wave_r_;
- const int16_t max_int16 = std::numeric_limits<int16_t>::max();
- int16_t* buf = reinterpret_cast<int16_t*>(samples);
- for (size_t i = 0; i < instance->obtained_sample_frame_count_; ++i) {
- const double l = sin(wave_l) * instance->amplitude_l_ * max_int16;
- const double r = sin(wave_r) * instance->amplitude_r_ * max_int16;
- *buf++ = static_cast<int16_t>(l);
- *buf++ = static_cast<int16_t>(r);
- // Add delta, keep within -kTwoPi..kTwoPi to preserve precision.
- wave_l += delta_l;
- if (wave_l > kTwoPi)
- wave_l -= kTwoPi * 2.0;
- wave_r += delta_r;
- if (wave_r > kTwoPi)
- wave_r -= kTwoPi * 2.0;
- }
- // Store current value to use as starting point for next callback.
- instance->audio_wave_l_ = wave_l;
- instance->audio_wave_r_ = wave_r;
-
- ++instance->callback_count_;
- }
-
- static void SilenceCallback(void* samples, uint32_t num_bytes, void* thiz) {
- memset(samples, 0, num_bytes);
- }
-
- // Audio config resource. Allocated in Init().
- pp::AudioConfig* config_;
-
- // Audio resource. Allocated in Init().
- pp::Audio* audio_;
-
- // Current audio wave position, used to prevent sine wave skips
- // on buffer boundaries.
- double audio_wave_l_;
- double audio_wave_r_;
-
- double frequency_l_;
- double frequency_r_;
-
- double amplitude_l_;
- double amplitude_r_;
-
- bool headless_;
-
- bool basic_tests_;
- bool stress_tests_;
-
- uint32_t duration_msec_;
- PP_AudioSampleRate obtained_sample_rate_;
- uint32_t obtained_sample_frame_count_;
-
- int callback_count_;
-};
-
-class MyModule : public pp::Module {
- public:
- // Override CreateInstance to create your customized Instance object.
- virtual pp::Instance* CreateInstance(PP_Instance instance) {
- return new MyInstance(instance);
- }
-};
-
-namespace pp {
-
-// Factory function for your specialization of the Module object.
-Module* CreateModule() {
- NaClLogModuleInit();
- return new MyModule();
-}
-
-} // namespace pp
diff --git a/ppapi/native_client/tests/ppapi_example_audio/nacl.scons b/ppapi/native_client/tests/ppapi_example_audio/nacl.scons
deleted file mode 100644
index 176cf3e0..0000000
--- a/ppapi/native_client/tests/ppapi_example_audio/nacl.scons
+++ /dev/null
@@ -1,27 +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 is a pepper audio example from examples/audio.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
- 'ppapi_example_audio/')
-
-nexe_name = env.ProgramNameForNmf('ppapi_example_audio')
-nexe = env.ComponentProgram(nexe_name,
- [ 'audio.cc' ],
- EXTRA_LIBS=['ppapi',
- 'ppapi_cpp',
- 'platform',
- 'gio',
- 'pthread',
- 'm'])
-
-# Note that the html is required to run this program.
-env.Publish(nexe_name, 'run',
- ['ppapi_example_audio.html'])
-
diff --git a/ppapi/native_client/tests/ppapi_example_audio/ppapi_example_audio.html b/ppapi/native_client/tests/ppapi_example_audio/ppapi_example_audio.html
deleted file mode 100644
index 1cf654c..0000000
--- a/ppapi/native_client/tests/ppapi_example_audio/ppapi_example_audio.html
+++ /dev/null
@@ -1,71 +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.
--->
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
- <META HTTP-EQUIV="Expires" CONTENT="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <title>PPAPI Audio</title>
- </head>
-
- <body>
- <h1>Native Client PPAPI Audio</h1>
- <div id="attach"></div>
- <br />Verify that a 400Hz tone is emitted on the left channel.<br />
- <br />Verify that a 1000Hz tone is emitted on the right
- channel.<br />
- <br />Note: This example depends on your system supporting audio
- output.<br />
-
- <script type="text/javascript">
- //<![CDATA[
-function setupTests(tester, plugin) {
-
- tester.addAsyncTest('TestPlayback', function(status) {
- // Register a message listener to receive test result.
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- status.assertEqual(message.data, 'StopOutput:PASSED');
- status.pass();
- });
- plugin.addEventListener("message", messageListener, false);
-
- // Tell the nexe to start playing audio.
- plugin.postMessage('StartPlayback');
- });
-}
-
-var playback;
-if (location.hash == "#mute") {
- playback = 'amplitude_l="0" amplitude_r="0" duration_msec="1000"' +
- 'headless="1"';
-} else {
- playback = 'amplitude_l="1" amplitude_r="1" duration_msec="10000"';
-}
-var node = document.createElement('div');
-node.innerHTML = '<embed id="naclModule" ' +
- 'name="naclModule" ' +
- 'width=0 height=0 ' +
- 'src="ppapi_example_audio.nmf" ' +
- 'basic_tests="1" ' +
- 'stress_tests="0" ' +
- 'style="background-color:gray" ' +
- 'type="application/x-nacl" ' +
- playback + ' />';
-document.getElementById('attach').appendChild(node);
-
-var tester = new Tester();
-setupTests(tester, $('naclModule'));
-tester.waitFor($('naclModule'));
-tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_example_events/nacl.scons b/ppapi/native_client/tests/ppapi_example_events/nacl.scons
deleted file mode 100644
index 1696ba3..0000000
--- a/ppapi/native_client/tests/ppapi_example_events/nacl.scons
+++ /dev/null
@@ -1,21 +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.
-
-Import('env')
-
-# TODO(robertm): those should not be necessary once we go -std=c99
-env.FilterOut(CFLAGS=['-pedantic'])
-env.FilterOut(CCFLAGS=['-pedantic'])
-
-nexe = env.ProgramNameForNmf('ppapi_example_events')
-env.Alias('ppapi_example_events${PROGSUFFIX}',
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-ppapi_example_events_nexe = env.ComponentProgram(nexe,
- ['ppapi_example_events.cc',],
- EXTRA_LIBS=['ppapi',
- 'ppapi_cpp'])
-env.Publish(nexe, 'run',
- ['ppapi_example_events.html',
- 'ppapi_example_events.nmf'])
diff --git a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.cc b/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.cc
deleted file mode 100644
index b1be6bd..0000000
--- a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.cc
+++ /dev/null
@@ -1,210 +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.
-
-// C headers
-#include <cassert>
-#include <cstdio>
-
-// C++ headers
-#include <sstream>
-#include <string>
-
-// NaCl
-#include "ppapi/cpp/input_event.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/module.h"
-#include "ppapi/cpp/point.h"
-#include "ppapi/cpp/var.h"
-
-namespace {
-const char* const kEventsPropertyName = "events";
-
-// Convert a given modifier to a descriptive string. Note that the actual
-// declared type of modifier in each of the event classes is uint32_t, but it is
-// expected to be interpreted as a bitfield of 'or'ed PP_InputEvent_Modifier
-// values.
-std::string ModifierToString(uint32_t modifier) {
- std::string s;
- if (modifier & PP_INPUTEVENT_MODIFIER_SHIFTKEY) {
- s += "shift ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_CONTROLKEY) {
- s += "ctrl ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_ALTKEY) {
- s += "alt ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_METAKEY) {
- s += "meta ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_ISKEYPAD) {
- s += "keypad ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_ISAUTOREPEAT) {
- s += "autorepeat ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_LEFTBUTTONDOWN) {
- s += "left-button-down ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_MIDDLEBUTTONDOWN) {
- s += "middle-button-down ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_RIGHTBUTTONDOWN) {
- s += "right-button-down ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_CAPSLOCKKEY) {
- s += "caps-lock ";
- }
- if (modifier & PP_INPUTEVENT_MODIFIER_NUMLOCKKEY) {
- s += "num-lock ";
- }
- return s;
-}
-
-std::string MouseButtonToString(PP_InputEvent_MouseButton button) {
- switch (button) {
- case PP_INPUTEVENT_MOUSEBUTTON_NONE:
- return "None";
- case PP_INPUTEVENT_MOUSEBUTTON_LEFT:
- return "Left";
- case PP_INPUTEVENT_MOUSEBUTTON_MIDDLE:
- return "Middle";
- case PP_INPUTEVENT_MOUSEBUTTON_RIGHT:
- return "Right";
- default:
- std::ostringstream stream;
- stream << "Unrecognized ("
- << static_cast<int32_t>(button)
- << ")";
- return stream.str();
- }
-}
-
-} // namespace
-
-class EventInstance : public pp::Instance {
- public:
- explicit EventInstance(PP_Instance instance)
- : pp::Instance(instance) {
- std::printf("EventInstance created.\n");
- RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL);
- RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
- }
- virtual ~EventInstance() {}
-
- void GotKeyEvent(const pp::KeyboardInputEvent& key_event,
- const std::string& kind) {
- std::ostringstream stream;
- stream << pp_instance() << ":"
- << " Key event:" << kind
- << " modifier:" << ModifierToString(key_event.GetModifiers())
- << " key_code:" << key_event.GetKeyCode()
- << " time:" << key_event.GetTimeStamp()
- << " text:" << key_event.GetCharacterText().DebugString()
- << "\n";
- std::printf("%s", stream.str().c_str());
- PostMessage(stream.str());
- }
-
- void GotMouseEvent(const pp::MouseInputEvent& mouse_event,
- const std::string& kind) {
- std::ostringstream stream;
- stream << pp_instance() << ":"
- << " Mouse event:" << kind
- << " modifier:" << ModifierToString(mouse_event.GetModifiers())
- << " button:" << MouseButtonToString(mouse_event.GetButton())
- << " x:" << mouse_event.GetPosition().x()
- << " y:" << mouse_event.GetPosition().y()
- << " click_count:" << mouse_event.GetClickCount()
- << " time:" << mouse_event.GetTimeStamp()
- << "\n";
- std::printf("%s", stream.str().c_str());
- PostMessage(stream.str());
- }
-
- void GotWheelEvent(const pp::WheelInputEvent& wheel_event) {
- std::ostringstream stream;
- stream << pp_instance() << ": Wheel event."
- << " modifier:" << ModifierToString(wheel_event.GetModifiers())
- << " deltax:" << wheel_event.GetDelta().x()
- << " deltay:" << wheel_event.GetDelta().y()
- << " wheel_ticks_x:" << wheel_event.GetTicks().x()
- << " wheel_ticks_y:" << wheel_event.GetTicks().y()
- << " scroll_by_page:"
- << (wheel_event.GetScrollByPage() ? "true" : "false")
- << "\n";
- std::printf("%s", stream.str().c_str());
- PostMessage(stream.str());
- }
-
- // Handle an incoming input event by switching on type and dispatching
- // to the appropriate subtype handler.
- virtual bool HandleInputEvent(const pp::InputEvent& event) {
- std::printf("HandleInputEvent called\n");
- switch (event.GetType()) {
- case PP_INPUTEVENT_TYPE_UNDEFINED:
- std::printf("Undefined event.\n");
- break;
- case PP_INPUTEVENT_TYPE_MOUSEDOWN:
- GotMouseEvent(pp::MouseInputEvent(event), "Down");
- break;
- case PP_INPUTEVENT_TYPE_MOUSEUP:
- GotMouseEvent(pp::MouseInputEvent(event), "Up");
- break;
- case PP_INPUTEVENT_TYPE_MOUSEMOVE:
- GotMouseEvent(pp::MouseInputEvent(event), "Move");
- break;
- case PP_INPUTEVENT_TYPE_MOUSEENTER:
- GotMouseEvent(pp::MouseInputEvent(event), "Enter");
- break;
- case PP_INPUTEVENT_TYPE_MOUSELEAVE:
- GotMouseEvent(pp::MouseInputEvent(event), "Leave");
- break;
- case PP_INPUTEVENT_TYPE_WHEEL:
- GotWheelEvent(pp::WheelInputEvent(event));
- break;
- case PP_INPUTEVENT_TYPE_RAWKEYDOWN:
- GotKeyEvent(pp::KeyboardInputEvent(event), "RawKeyDown");
- break;
- case PP_INPUTEVENT_TYPE_KEYDOWN:
- GotKeyEvent(pp::KeyboardInputEvent(event), "Down");
- break;
- case PP_INPUTEVENT_TYPE_KEYUP:
- GotKeyEvent(pp::KeyboardInputEvent(event), "Up");
- break;
- case PP_INPUTEVENT_TYPE_CHAR:
- GotKeyEvent(pp::KeyboardInputEvent(event), "Character");
- break;
- default:
- std::printf("Unrecognized event type: %d\n", event.GetType());
- assert(false);
- return false;
- }
- return true;
- }
-};
-
-// The EventModule provides an implementation of pp::Module that creates
-// EventInstance objects when invoked. This is part of the glue code that makes
-// our example accessible to ppapi.
-class EventModule : public pp::Module {
- public:
- EventModule() : pp::Module() {}
- virtual ~EventModule() {}
-
- virtual pp::Instance* CreateInstance(PP_Instance instance) {
- std::printf("Creating EventInstance.\n");
- return new EventInstance(instance);
- }
-};
-
-// Implement the required pp::CreateModule function that creates our specific
-// kind of Module (in this case, EventModule). This is part of the glue code
-// that makes our example accessible to ppapi.
-namespace pp {
- Module* CreateModule() {
- std::printf("Creating EventModule.\n");
- return new EventModule();
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html b/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html
deleted file mode 100644
index 085a8d7..0000000
--- a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
- 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.
- -->
-<head>
- <title>PPAPI InputEvent test</title>
-
- <script type="text/javascript">
- function $(id) {
- return document.getElementById(id);
- }
-
- var events = '';
-
- function receiveMessage(message) {
- events += message.data;
- }
-
- function getEvents() {
- try {
- var event_dump = $('event_dump');
- event_dump.firstChild.nodeValue = events;
- events = '';
- } catch(e) {
- alert(e.message);
- }
- }
- </script>
-</head>
-<body>
-<h1>InputEvent Handling Example</h1>
- <div id="listener">
- <script type="text/javascript">
- $('listener').addEventListener('message', receiveMessage, true);
- </script>
-
- <embed name="nacl_module"
- id="event_module"
- width=400 height=400
- src="ppapi_example_events.nmf"
- type="application/x-nacl"
- style="background-color:gray" />
- </div>
-<p>
-This example demonstrates handling of input events in PPAPI.
-<p>
-Each time an input event happens in the context of the gray box,
-the embedded NaCl module prints a message describing the event to the shell
-where you started your Browser.
-<p>
-Alternatively, you can click the "Get Events" button to display
-all input events that have happened since the last time you clicked the
-button.
-</p>
-<form name="event_form" action="" method="get">
- <input type="button" value="Get Events" onclick="getEvents()"/>
-</form>
-
-<h2>Recent Events (press button to update):</h2>
-<pre id=event_dump>
-no events
-</pre>
-</body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.nmf b/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.nmf
deleted file mode 100644
index 902e4457..0000000
--- a/ppapi/native_client/tests/ppapi_example_events/ppapi_example_events.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_example_events_x86-32.nexe"},
- "x86-64": {"url": "ppapi_example_events_x86-64.nexe"},
- "arm": {"url": "ppapi_example_events_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_example_gles2/nacl.scons b/ppapi/native_client/tests/ppapi_example_gles2/nacl.scons
deleted file mode 100644
index cceb5d5..0000000
--- a/ppapi/native_client/tests/ppapi_example_gles2/nacl.scons
+++ /dev/null
@@ -1,39 +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 is a Pepper 3D (OpenGLES2) example from ppapi/examples/gles2.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Append(CPPPATH=['$SOURCE_ROOT/ppapi/lib/gl/include'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
- 'ppapi_example_gles2/')
-
-nexe_name = env.ProgramNameForNmf('ppapi_example_gles2')
-obj = env.ComponentObject(
- 'gles2',
- '$SOURCE_ROOT/ppapi/examples/gles2/gles2.cc'
- )
-nexe = env.ComponentProgram(nexe_name, [obj],
- EXTRA_LIBS=['ppapi', 'ppapi_cpp'])
-
-# Note that the html is required to run this program.
-env.Publish(nexe_name, 'run',
- ['ppapi_example_gles2.html'])
-
-test = env.PPAPIBrowserTester('ppapi_example_gles2_test.out',
- url='ppapi_example_gles2.html',
- nmf_names=['ppapi_example_gles2'],
- files=env.ExtractPublishedFiles(nexe_name),
- args=['--enable_experimental_js'])
-
-env.AddNodeToTestSuite(test,
- ['chrome_browser_tests'],
- 'run_ppapi_example_gles2_test',
- # TODO(cstefansen): When fixed set to
- # env.PPAPIBrowserTesterIsBroken().
- # code.google.com/p/nativeclient/issues/detail?id=1936
- is_broken=env.Bit('nacl_glibc'))
diff --git a/ppapi/native_client/tests/ppapi_example_gles2/ppapi_example_gles2.html b/ppapi/native_client/tests/ppapi_example_gles2/ppapi_example_gles2.html
deleted file mode 100644
index a256414..0000000
--- a/ppapi/native_client/tests/ppapi_example_gles2/ppapi_example_gles2.html
+++ /dev/null
@@ -1,51 +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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <title>Native Client PPAPI Graphics3D (OpenGL ES)</title>
- </head>
-
- <body>
- <h1>Native Client PPAPI Graphics3D (OpenGL ES)</h1>
- <div>
- <embed id="naclModule"
- name="naclModule"
- width=400 height=400
- src="ppapi_example_gles2.nmf"
- basic_tests="1"
- stress_tests="0"
- style="background-color:gray"
- type="application/x-nacl" />
- </div>
- <p>The example works if you see a square flickering between red and
- blue above. Note that the automated test only verifies that the
- NaCl module loaded. It cannot and does not verify that the visual
- output is correct.
-
- <script type="text/javascript">
- //<![CDATA[
-function setupTests(tester, plugin) {
- // The PPAPI font examples does all its work in DidChangeView, so we just
- // verify that it loaded successfully by inserting a dummy test.
- // This only tests that DidChangeView completed successfully; we have no
- // automated way of checking that it actually plotted the fonts.
- tester.addAsyncTest('DummyTestToEnsureThatModuleCompletedLoading',
- function(status) { status.pass(); });
-}
-
-var tester = new Tester();
-setupTests(tester, $('naclModule'));
-tester.waitFor($('naclModule'));
-tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_example_post_message/nacl.scons b/ppapi/native_client/tests/ppapi_example_post_message/nacl.scons
deleted file mode 100644
index 5f3a939..0000000
--- a/ppapi/native_client/tests/ppapi_example_post_message/nacl.scons
+++ /dev/null
@@ -1,36 +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 is a Pepper PostMessage example from ppapi/examples/scripting.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
- 'ppapi_example_post_message/')
-
-nexe_name = env.ProgramNameForNmf('ppapi_example_post_message')
-obj = env.ComponentObject(
- 'post_message',
- '$SOURCE_ROOT/ppapi/examples/scripting/post_message.cc'
- )
-nexe = env.ComponentProgram(nexe_name, [obj],
- EXTRA_LIBS=['ppapi', 'ppapi_cpp'])
-
-# Note that the html is required to run this program.
-env.Publish(nexe_name, 'run',
- ['ppapi_example_post_message.html'])
-
-
-test = env.PPAPIBrowserTester(
- 'ppapi_example_post_message_test.out',
- url='ppapi_example_post_message.html',
- nmf_names=['ppapi_example_post_message'],
- files=env.ExtractPublishedFiles(nexe_name))
-
-env.AddNodeToTestSuite(test,
- ['chrome_browser_tests'],
- 'run_ppapi_example_post_message_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html b/ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html
deleted file mode 100644
index 7a7b8d5..0000000
--- a/ppapi/native_client/tests/ppapi_example_post_message/ppapi_example_post_message.html
+++ /dev/null
@@ -1,60 +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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <title>Native Client PPAPI Post Message Example</title>
- </head>
-
- <body>
- <h1>Native Client PPAPI Post Message Example</h1>
- <div>
- <embed id="naclModule"
- name="naclModule"
- width=400 height=400
- src="ppapi_example_post_message.nmf"
- basic_tests="2"
- stress_tests="0"
- style="background-color:gray"
- type="application/x-nacl" />
- </div>
-
- <script type="text/javascript">
- //<![CDATA[
-function setupTests(tester, plugin) {
- tester.addAsyncTest('TestPalindrome', function(status) {
- // Try posting a palindrome to the plugin.
- plugin.addEventListener('message', function(message_event) {
- this.removeEventListener('message', arguments.callee, false);
- status.assertEqual(message_event.data, true);
- status.pass();
- }, false);
- plugin.postMessage('amokigleredderelgikoma');
- });
-
- tester.addAsyncTest('TestNonPalindrome', function(status) {
- // Try posting a non-palindrome.
- plugin.addEventListener('message', function(message_event) {
- this.removeEventListener('message', arguments.callee, false);
- status.assertEqual(message_event.data, false);
- status.pass();
- }, false);
- plugin.postMessage('This is not a palindrome.');
- });
-}
-
-var tester = new Tester();
-setupTests(tester, $('naclModule'));
-tester.waitFor($('naclModule'));
-tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_gles_book/nacl.scons b/ppapi/native_client/tests/ppapi_gles_book/nacl.scons
deleted file mode 100644
index 02d6422..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/nacl.scons
+++ /dev/null
@@ -1,92 +0,0 @@
-# -*- python -*-
-# Copyright 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.
-
-# OpenGL ES examples
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX', 'GL_GLEXT_PROTOTYPES'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
- 'ppapi_gles_book/')
-
-# Underlay $SOURCE_ROOT/gpu in this directory.
-Dir('.').addRepository(Dir('#/../gpu'))
-
-# Underlay $SOURCE_ROOT/third_party/gles2_book in this directory.
-Dir('.').addRepository(Dir('#/../third_party/gles2_book'))
-
-# Don't warn on pointer signedness issues (third_party sources)
-env.Append(CFLAGS=['-Wno-pointer-sign'])
-# ..and don't warn about missing braces
-env.Append(CCFLAGS=['-Wno-missing-braces'])
-
-# Add local path to find GPU sources and GLES2 includes.
-env.Append(CPPPATH=[
- '$SOURCE_ROOT/third_party/gles2_book/Common/Include',
- '$SOURCE_ROOT/ppapi/lib/gl/include',
- ])
-
-gles_demo_srcs = [
- 'Common/Source/esShader.c',
- 'Common/Source/esShapes.c',
- 'Common/Source/esTransform.c',
- 'Common/Source/esUtil.c',
- 'demos/framework/demo.cc',
- 'demos/framework/pepper.cc',
- ]
-
-env.ComponentLibrary('ppapi_gles_demo', gles_demo_srcs)
-
-gles_book_examples = {
- 'hello_triangle': [
- 'Chapter_2/Hello_Triangle/Hello_Triangle.c'],
- 'mip_map_2d': [
- 'Chapter_9/MipMap2D/MipMap2D.c'],
- 'simple_texture_2d': [
- 'Chapter_9/Simple_Texture2D/Simple_Texture2D.c'],
- 'simple_texture_cubemap': [
- 'Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c'],
- 'simple_vertex_shader': [
- 'Chapter_8/Simple_VertexShader/Simple_VertexShader.c'],
- 'stencil_test': [
- 'Chapter_11/Stencil_Test/Stencil_Test.c'],
- 'texture_wrap': [
- 'Chapter_9/TextureWrap/TextureWrap.c'],
-}
-
-# TODO(jvoung): PPAPIGraphics3DIsBroken is currently marked True.
-# When we turn on these tests again, be sure to convert these
-# NMF files to work with PNaCl (have a portable-only version).
-# For now, we just avoid adding them to a test suite.
-if env.Bit('bitcode'):
- Return()
-
-for demo, sources in gles_book_examples.iteritems():
- nexe_name = env.ProgramNameForNmf('ppapi_gles_book_%s' % demo)
- nmf_name = 'ppapi_gles_book_' + demo + '.nmf'
- nexe = env.ComponentProgram(
- nexe_name,
- ['demos/gles2_book/demo_' + demo + '.cc'] + sources,
- EXTRA_LIBS=['ppapi',
- 'ppapi_cpp',
- 'ppapi_gles_demo',
- 'ppapi_cpp',
- 'ppapi_gles2',
- 'm'])
- env.Publish(nexe_name, 'run',
- ['ppapi_gles_book.html'])
- test = env.PPAPIBrowserTester(
- 'ppapi_gles_book_' + demo + '.out',
- url='ppapi_gles_book.html?manifest=' + nmf_name,
- nmfs=['${TEST_DIR}/' + nmf_name],
- files=[nexe,
- env.File('ppapi_gles_book.html')],
- browser_flags=['--enable-accelerated-plugins'])
- env.AddNodeToTestSuite(
- test,
- ['chrome_browser_tests'],
- 'run_ppapi_gles_book_' + demo + '_test',
- is_broken=env.PPAPIBrowserTesterIsBroken() or
- env.PPAPIGraphics3DIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book.html b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book.html
deleted file mode 100644
index 71dc99c..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book.html
+++ /dev/null
@@ -1,101 +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.
--->
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <title>PPAPI OpenGL ES Book Examples</title>
- </head>
-
- <body>
- <h1>PPAPI OpenGL ES Book Examples</h1>
- <table style="border-spacing: 20pt;" summary="List of GLES book tests">
- <tr style="vertical-align: top;">
- <td>
- <h2>Examples available and expected output</h2>
- <p><a href="?manifest=ppapi_gles_book_hello_triangle.nmf">
- hello_triangle</a>
- Red triangle</p>
- <p><a href="?manifest=ppapi_gles_book_mip_map_2d.nmf">mip_map_2d</a>
- Two red/blue chess board-patterned planes</p>
- <p><a href="?manifest=ppapi_gles_book_simple_texture_2d.nmf">
- simple_texture_2d</a>
- 2x2 matrix with red, green, blue, and yellow squares</p>
- <p><a href="?manifest=ppapi_gles_book_simple_texture_cubemap.nmf">
- simple_texture_cubemap</a>
- Ball with blue, red, yellow, and green patches; purple in the
- center.</p>
- <p><a href="?manifest=ppapi_gles_book_simple_vertex_shader.nmf">
- simple_vertex_shader</a>
- Rotating red square</p>
- <p><a href="?manifest=ppapi_gles_book_stencil_test.nmf">stencil_test</a>
- EXPECTED OUTPUT UNKNOWN</p>
- <p><a href="?manifest=ppapi_gles_book_texture_wrap.nmf">texture_wrap</a>
- Three blue/red patterns</p>
- <h2>Troubleshooting</h2>
- <p>Make sure you start Chrome with
- <tt>--enable-accelerated-plugins</tt>.</p>
- <p>Check the JavaScript console.</p>
- </td>
- <td>
- <div id="attach" style="background-image:
- url(http://www.google.com/intl/en_ALL/images/logo.gif);
- background-repeat:repeat"></div>
- </td>
- </tr>
- </table>
-
- <script type="text/javascript">
- //<![CDATA[
-function ExtractSearchParameter(name) {
- var nameIndex = location.search.indexOf(name + '=');
- if (nameIndex != -1) {
- var value = location.search.substring(nameIndex + name.length + 1);
- var endIndex = value.indexOf('&');
- if (endIndex != -1)
- value = value.substring(0, endIndex);
- return value;
- }
- return '';
-}
-
-function setupTests(tester, plugin) {
- // This template is built for tests where we only need to (or can)
- // verify that the nexe loaded successfully. We do this by inserting
- // following dummy test.
- // This only tests that loading and any start-up testing (typically
- // within DidChangeView) returned success; there is no
- // automated way of checking that it did as intended beyond that.
- tester.addAsyncTest('DummyTestToEnsureLoadingComplete_' + manifest,
- function(status) { status.pass(); });
-}
-
-var manifest = ExtractSearchParameter('manifest');
-if (!manifest) manifest = 'ppapi_gles_book_hello_triangle.nmf';
-document.title = 'Test ' + manifest;
-
-var node = document.createElement('div');
-node.innerHTML = '<embed id="naclModule" ' +
- 'name="naclModule" ' +
- 'width=400 height=400 ' +
- 'src="' + manifest + '" ' +
- 'basic_tests="1" ' +
- 'stress_tests="0" ' +
- 'type="application/x-nacl" ' +
- ' />';
-document.getElementById('attach').appendChild(node);
-
-var tester = new Tester();
-setupTests(tester, $('naclModule'));
-tester.waitFor($('naclModule'));
-tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_hello_triangle.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_hello_triangle.nmf
deleted file mode 100644
index 694d416..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_hello_triangle.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_hello_triangle_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_hello_triangle_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_hello_triangle_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_mip_map_2d.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_mip_map_2d.nmf
deleted file mode 100644
index c0e1357..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_mip_map_2d.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_mip_map_2d_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_mip_map_2d_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_mip_map_2d_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_2d.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_2d.nmf
deleted file mode 100644
index 3f47f1b..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_2d.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_simple_texture_2d_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_simple_texture_2d_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_simple_texture_2d_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_cubemap.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_cubemap.nmf
deleted file mode 100644
index 230ea191..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_texture_cubemap.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_simple_texture_cubemap_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_simple_texture_cubemap_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_simple_texture_cubemap_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_vertex_shader.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_vertex_shader.nmf
deleted file mode 100644
index 12949c7..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_simple_vertex_shader.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_simple_vertex_shader_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_simple_vertex_shader_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_simple_vertex_shader_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_stencil_test.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_stencil_test.nmf
deleted file mode 100644
index 260da7e..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_stencil_test.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_stencil_test_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_stencil_test_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_stencil_test_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_texture_wrap.nmf b/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_texture_wrap.nmf
deleted file mode 100644
index d3f3eb7..0000000
--- a/ppapi/native_client/tests/ppapi_gles_book/ppapi_gles_book_texture_wrap.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-32": {"url": "ppapi_gles_book_texture_wrap_x86-32.nexe"},
- "x86-64": {"url": "ppapi_gles_book_texture_wrap_x86-64.nexe"},
- "arm": {"url": "ppapi_gles_book_texture_wrap_arm.nexe"}
- }
-}
diff --git a/ppapi/native_client/tests/ppapi_simple_tests/nacl.scons b/ppapi/native_client/tests/ppapi_simple_tests/nacl.scons
deleted file mode 100644
index d1b7811..0000000
--- a/ppapi/native_client/tests/ppapi_simple_tests/nacl.scons
+++ /dev/null
@@ -1,71 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2011 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.
-
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-
-
-######################################################################
-# REPLAY TESTS
-######################################################################
-TESTS = [('audio', ('audio',)),
- ('graphics2d',('graphics2d',)),
- ('event', ('event',)),
- ('file', ('file1', 'file2')),
- ]
-
-for test_exe, test_inputs in TESTS:
- nexe = env.ComponentProgram('ppapi_simple_' + test_exe,
- [test_exe + '.cc'],
- EXTRA_LIBS=['ppapi',
- 'ppapi_cpp',
- 'platform',
- 'gio',
- 'pthread',
- 'm',
- ])
-
- for test in test_inputs:
- node = env.SelUniversalTest(
- 'ppapi_simple_' + test + '.out',
- nexe,
- sel_universal_flags=[
- '--silence_nexe',
- '--command_file',
- env.File('sel_universal_ppapi_replay_prolog.stdin'),
- '--command_file',
- env.File(test +'.stdin'),
- ],
- uses_ppapi=True,
- stdout_golden=env.File(test + '.stdout'),
- )
-
- env.AddNodeToTestSuite(node,
- ['small_tests', 'sel_ldr_tests'],
- 'run_ppapi_simple_' + test + '_test')
-
-######################################################################
-# EMULATOR TESTS
-######################################################################
-node = env.SelUniversalTest(
- 'ppapi_emu_file.out',
- env.File('ppapi_simple_file${PROGSUFFIX}'),
- sel_universal_flags=[
- '--silence_nexe',
- '--command_file',
- env.File('ppapi_emu_file.stdin'),
- '--url_alias',
- 'test.txt', # c.f. ppapi_emu_file.stdin
- env.File('test.txt'),
- ],
- uses_ppapi=True,
- stdout_golden=env.File('ppapi_emu_file.stdout'),
- )
-
-env.AddNodeToTestSuite(node,
- ['small_tests', 'sel_ldr_tests'],
- 'run_ppapi_emu_file_test')
diff --git a/ppapi/native_client/tests/ppapi_test_example/nacl.scons b/ppapi/native_client/tests/ppapi_test_example/nacl.scons
deleted file mode 100644
index 7459f5d..0000000
--- a/ppapi/native_client/tests/ppapi_test_example/nacl.scons
+++ /dev/null
@@ -1,49 +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 demonstrates sample usage of ppapi_test_lib.
-#
-# These ppapi_test_lib/ headers should be used by the test setup:
-# test_interface.h - test interface + setup to be implemented by the tester.
-# get_browser_interface.h - provides getters for proxy-supported interfaces.
-#
-# ppapi_test_example.cc - sample implementation test_interface.h.
-# ppapi_test_example.html - sample test driver that uses scripting.
-# ppapi_test_example.js - setup for sample test driver.
-# ppapi_test_example.nmf - sample manifest for platform-specific nexes.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/' +
- 'ppapi_test_example/')
-
-nexe = env.ProgramNameForNmf('ppapi_test_example')
-env.Alias('ppapi_test_example${PROGSUFFIX}',
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-
-ppapi_test_example_nexe = env.ComponentProgram(
- nexe,
- ['ppapi_test_example.cc'],
- EXTRA_LIBS=['ppapi',
- 'ppapi_test_lib',
- 'platform', # for CHECK
- 'pthread',
- 'gio',
- ])
-
-env.Publish(nexe, 'run',
- ['ppapi_test_example.html',
- 'ppapi_test_example.js'])
-
-node = env.PPAPIBrowserTester('ppapi_test_example_browser_test.out',
- url='ppapi_test_example.html',
- nmf_names=['ppapi_test_example'],
- files=env.ExtractPublishedFiles(nexe))
-
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_ppapi_test_example_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken())
diff --git a/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.cc b/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.cc
deleted file mode 100644
index 50b98f7..0000000
--- a/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.cc
+++ /dev/null
@@ -1,46 +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 "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/ppb_core.h"
-
-namespace {
-
-void Callback(void* /*data*/, int32_t /*result*/) {
- printf("--- Callback\n");
-}
-
-void TestSimple() {
- printf("--- TestSimple\n");
- EXPECT(pp_instance() != kInvalidInstance);
- EXPECT(pp_module() != kInvalidModule);
- TEST_PASSED;
-}
-
-void TestCallback() {
- printf("--- TestCallback\n");
- PP_CompletionCallback callback = MakeTestableCompletionCallback(
- "Callback", Callback, NULL /*user_data*/);
- PPBCore()->CallOnMainThread(10, callback, PP_OK);
- TEST_PASSED;
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("TestSimple", TestSimple);
- RegisterTest("TestCallback", TestCallback);
-}
-
-void SetupPluginInterfaces() {
- // TODO(polina): add an example of PPP interface testing
-}
diff --git a/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.html b/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.html
deleted file mode 100644
index 76917bc..0000000
--- a/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.html
+++ /dev/null
@@ -1,31 +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>
- <!-- TODO(tester): change JavaScript file name -->
- <script type="text/javascript" src="ppapi_test_example.js"></script>
- <title>PPAPI Test Example</title> <!-- TODO(tester): change title -->
- </head>
- <body>
- <h1>PPAPI Test Example</h1> <!-- TODO(tester): change heading -->
-
- <!-- TODO(tester): change manifest file name -->
- <embed type="application/x-nacl" id="test_nexe"
- name="nacl_module"
- src="ppapi_test_example.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_test_example/ppapi_test_example.js b/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.js
deleted file mode 100644
index d9c6021..0000000
--- a/ppapi/native_client/tests/ppapi_test_example/ppapi_test_example.js
+++ /dev/null
@@ -1,41 +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) {
- // TODO(tester): replace with your tests.
-
- // Below are sample test cases demonstrating postMessage as the test
- // driving mechanism.
-
- tester.addAsyncTest('Example::Simple', function(status) {
- var messageListener = status.wrap(function(message) {
- status.log('Received message: ' + message.data);
- plugin.removeEventListener('message', messageListener, false);
- status.assertEqual(message.data, 'TestSimple:PASSED');
- status.pass();
- });
-
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestSimple");
- });
-
- tester.addAsyncTest('Example::Callback', 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, 'TestCallback:PASSED');
- gotPassed = true;
- plugin.addEventListener("message", messageListener, false);
- } else {
- status.assertEqual(message.data, 'Callback');
- status.pass();
- }
- });
-
- plugin.addEventListener("message", messageListener, false);
- plugin.postMessage("TestCallback");
- });
-}
diff --git a/ppapi/native_client/tests/ppapi_tests/nacl.scons b/ppapi/native_client/tests/ppapi_tests/nacl.scons
deleted file mode 100644
index ab9b6ee..0000000
--- a/ppapi/native_client/tests/ppapi_tests/nacl.scons
+++ /dev/null
@@ -1,114 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2011 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.
-
-Import('env')
-import os
-
-if env.Bit('nacl_glibc'):
- Return()
-
-fullarch_map = {
- 'x86-64': 'x64',
- 'x86-32': 'x32',
- 'arm': 'arm',
- }
-
-ppapi_tests_target = ('ppapi_tests_newlib_%s' %
- fullarch_map[env['TARGET_FULLARCH']])
-
-ppapi_tests_sources = [
- # Common test files
- 'test_case.cc',
- 'test_utils.cc',
- 'testing_instance.cc',
-
- # Compile-time tests
- 'test_c_includes.c',
- 'test_cpp_includes.cc',
- 'test_struct_sizes.c',
-
- # Test cases (PLEASE KEEP THIS SECTION IN ALPHABETICAL ORDER)
- # Add/uncomment PPAPI interfaces below when they get proxied.
- # Not yet proxied.
- #'test_broker.cc',
- # Not yet proxied.
- #'test_buffer.cc',
- # Not yet proxied.
- #'test_char_set.cc',
- # Fails in DeleteDirectoryRecursively.
- # BUG: http://code.google.com/p/nativeclient/issues/detail?id=2107
- #'test_directory_reader.cc',
- 'test_file_io.cc',
- 'test_file_ref.cc',
- 'test_file_system.cc',
- 'test_memory.cc',
- 'test_mouse_cursor.cc',
- 'test_graphics_2d.cc',
- 'test_image_data.cc',
- 'test_paint_aggregator.cc',
- # test_post_message.cc relies on synchronous scripting, which is not
- # available for untrusted tests.
- # Does not compile under nacl (uses private interface ExecuteScript).
- #'test_post_message.cc',
- # Not yet proxied.
- #'test_transport.cc',
- # Not yet proxied.
- #'test_uma.cc',
- # Activating the URL loader test requires a test httpd that
- # understands HTTP POST, which our current httpd.py doesn't.
- # It also requires deactivating the tests that use FileIOTrusted
- # when running in NaCl.
- #'test_url_loader.cc',
- # Does not compile under nacl (uses VarPrivate).
- #'test_url_util.cc',
- # Not yet proxied.
- #'test_video_decoder.cc',
- 'test_var.cc',
-
- # Deprecated test cases.
- #'test_instance_deprecated.cc',
- # Var_deprecated fails in TestPassReference, and we probably won't
- # fix it.
- #'test_var_deprecated.cc'
- ]
-
-# Pepper code has small issues like extra commas at the end of enums.
-env.FilterOut(CFLAGS=['-pedantic'])
-env.FilterOut(CCFLAGS=['-pedantic'])
-
-# This abstracts away that we are including sources from another
-# directory. It is also necessary to work around a scons bug that
-# causes object files to end up in the wrong directory.
-def MakeComponentObject(src):
- return env.ComponentObject(
- os.path.splitext(src)[0],
- os.path.join('$SOURCE_ROOT/ppapi/tests', src))
-
-ppapi_tests_objs = [MakeComponentObject(src) for src in ppapi_tests_sources]
-
-ppapi_tests_nexe = env.ComponentProgram(ppapi_tests_target,
- ppapi_tests_objs,
- EXTRA_LIBS=['ppapi',
- 'ppapi_cpp'
- ])
-
-# Note that the html is required to run this program.
-# To run, load page with mode=nacl search string:
-# http://localhost:5103/scons-out/nacl-x86-32/staging/test_case.html?mode=nacl
-# http://localhost:5103/scons-out/nacl-x86-64/staging/test_case.html?mode=nacl
-
-# NOTE: This test is also run as part of the pyauto suite.
-# See pyauto_nacl/nacl.scons.
-
-env.Publish(ppapi_tests_target, 'run',
- ['$SOURCE_ROOT/ppapi/tests/test_url_loader_data/*'],
- subdir='test_url_loader_data')
-
-env.Publish(ppapi_tests_target, 'run',
- [ppapi_tests_nexe,
- '$SOURCE_ROOT/ppapi/tests/test_case.html',
- 'test_case.nmf',
- '$SOURCE_ROOT/ppapi/tests/test_image_data',
- '$SOURCE_ROOT/ppapi/tests/test_page.css'])
diff --git a/ppapi/native_client/tests/ppapi_tests/test_case.nmf b/ppapi/native_client/tests/ppapi_tests/test_case.nmf
deleted file mode 100644
index f0bb249..0000000
--- a/ppapi/native_client/tests/ppapi_tests/test_case.nmf
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "program": {
- "x86-64": {"url": "ppapi_nacl_tests_newlib_x64.nexe"},
- "x86-32": {"url": "ppapi_nacl_tests_newlib_x32.nexe"},
- "arm": {"url": "ppapi_nacl_tests_newlib_arm.nexe"}
- }
-}
diff --git a/ppapi/ppapi_tests.gypi b/ppapi/ppapi_tests.gypi
index 6c1d95c..6aa5499 100644
--- a/ppapi/ppapi_tests.gypi
+++ b/ppapi/ppapi_tests.gypi
@@ -29,7 +29,7 @@
'tests/test_case.html',
'tests/test_case.html.mock-http-headers',
'tests/test_page.css',
- 'native_client/tests/ppapi_tests/ppapi_nacl_tests_newlib.nmf',
+ 'tests/ppapi_nacl_tests_newlib.nmf',
],
},
{
diff --git a/ppapi/native_client/tests/ppapi_tests/ppapi_nacl_tests_newlib.nmf b/ppapi/tests/ppapi_nacl_tests_newlib.nmf
index f0bb249..f0bb249 100644
--- a/ppapi/native_client/tests/ppapi_tests/ppapi_nacl_tests_newlib.nmf
+++ b/ppapi/tests/ppapi_nacl_tests_newlib.nmf