Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: tests/ppapi_test_example/ppapi_test_example.cc

Issue 7292002: Remove plugin connection to PPAPI scriptable objects (var deprecated). Also (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/ppapi_proxy/user_main.nmf ('k') | tests/ppapi_test_example/ppapi_test_example.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. 1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string.h> 5 #include <string.h>
6 6
7 #include "native_client/src/include/nacl_macros.h" 7 #include "native_client/src/include/nacl_macros.h"
8 #include "native_client/src/shared/platform/nacl_check.h" 8 #include "native_client/src/shared/platform/nacl_check.h"
9 #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" 9 #include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
10 #include "native_client/tests/ppapi_test_lib/test_interface.h" 10 #include "native_client/tests/ppapi_test_lib/test_interface.h"
11 11
12 #include "ppapi/c/pp_bool.h" 12 #include "ppapi/c/pp_bool.h"
13 #include "ppapi/c/pp_errors.h" 13 #include "ppapi/c/pp_errors.h"
14 #include "ppapi/c/ppb_core.h" 14 #include "ppapi/c/ppb_core.h"
15 15
16 namespace { 16 namespace {
17 17
18 void Callback(void* /*data*/, int32_t /*result*/) { 18 void Callback(void* /*data*/, int32_t /*result*/) {
19 printf("--- Callback\n"); 19 printf("--- Callback\n");
20 } 20 }
21 21
22 // Below are the before & after versions of sample test cases demonstrating 22 void TestSimple() {
23 // how to transition from synchronous scripting to postMessage as the test 23 printf("--- TestSimple\n");
24 // driving mechanism.
25
26 // Before.
27 PP_Var TestSimpleSync() {
28 printf("--- TestSimpleSync\n");
29 EXPECT(pp_instance() != kInvalidInstance); 24 EXPECT(pp_instance() != kInvalidInstance);
30 EXPECT(pp_module() != kInvalidModule); 25 EXPECT(pp_module() != kInvalidModule);
31 return TEST_PASSED; 26 TEST_PASSED;
32 } 27 }
33 28
34 // After. 29 void TestCallback() {
35 void TestSimpleAsync() { 30 printf("--- TestCallback\n");
36 printf("--- TestSimpleAsync\n");
37 EXPECT_ASYNC(pp_instance() != kInvalidInstance);
38 EXPECT_ASYNC(pp_module() != kInvalidModule);
39 TEST_PASSED_ASYNC;
40 }
41
42 // Before.
43 PP_Var TestCallbackSync() {
44 printf("--- TestCallbackSync\n");
45 PP_CompletionCallback callback = MakeTestableCompletionCallback( 31 PP_CompletionCallback callback = MakeTestableCompletionCallback(
46 "CallbackSync", Callback, NULL /*user_data*/); 32 "Callback", Callback, NULL /*user_data*/);
47 PPBCore()->CallOnMainThread(10, callback, PP_OK); 33 PPBCore()->CallOnMainThread(10, callback, PP_OK);
48 return TEST_PASSED; 34 TEST_PASSED;
49 }
50
51 // After.
52 void TestCallbackAsync() {
53 printf("--- TestCallbackAsync\n");
54 PP_CompletionCallback callback = MakeTestableCompletionCallback(
55 "CallbackAsync", Callback, NULL /*user_data*/);
56 PPBCore()->CallOnMainThread(10, callback, PP_OK);
57 TEST_PASSED_ASYNC;
58 } 35 }
59 36
60 } // namespace 37 } // namespace
61 38
62 void SetupTests() { 39 void SetupTests() {
63 // Before. 40 RegisterTest("TestSimple", TestSimple);
64 RegisterScriptableTest("TestSimpleSync", TestSimpleSync); 41 RegisterTest("TestCallback", TestCallback);
65 RegisterScriptableTest("TestCallbackSync", TestCallbackSync);
66 // After.
67 RegisterTest("TestSimpleAsync", TestSimpleAsync);
68 RegisterTest("TestCallbackAsync", TestCallbackAsync);
69 } 42 }
70 43
71 void SetupPluginInterfaces() { 44 void SetupPluginInterfaces() {
72 // TODO(polina): add an example of PPP interface testing 45 // TODO(polina): add an example of PPP interface testing
73 } 46 }
OLDNEW
« no previous file with comments | « tests/ppapi_proxy/user_main.nmf ('k') | tests/ppapi_test_example/ppapi_test_example.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698