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

Side by Side Diff: chrome/test/data/nacl/manifest_file/irt_manifest_file_fail_test.cc

Issue 303683005: Add failure case for manifest file testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | chrome/test/data/nacl/manifest_file/irt_manifest_file_fail_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
Mark Seaborn 2014/05/28 16:30:34 Could you possibly merge this into the existing te
hidehiko 2014/05/29 06:58:39 Ok, I rewrote most of code. How about this?
2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 //
8 // Test for resource open before PPAPI initialization.
9 //
10
11 #include <stdio.h>
12 #include <string.h>
13
14 #include <sstream>
15 #include <string>
16
17 #include "native_client/src/untrusted/irt/irt.h"
18 #include "native_client/src/untrusted/nacl/nacl_irt.h"
19
20 #include "ppapi/cpp/instance.h"
21 #include "ppapi/cpp/module.h"
22 #include "ppapi/cpp/var.h"
23 #include "ppapi/native_client/src/shared/ppapi_proxy/ppruntime.h"
24
25 int error = 0;
26
27 void load_manifest(TYPE_nacl_irt_query *query_func) {
28 struct nacl_irt_resource_open nacl_irt_resource_open;
29 if (sizeof(nacl_irt_resource_open) !=
30 (*query_func)(
31 NACL_IRT_RESOURCE_OPEN_v0_1,
32 &nacl_irt_resource_open,
33 sizeof(nacl_irt_resource_open))) {
34 printf("irt_resource_open is not found.\n");
35 return;
36 }
37
38 int desc;
39 error = nacl_irt_resource_open.open_resource("non-exist-file", &desc);
Mark Seaborn 2014/05/28 16:30:34 Nit: "non-existent-file" perhaps?
hidehiko 2014/05/29 06:58:39 Done, in irt_manifest_file_test.cc.
40 if (error == 0) {
41 printf("Unexpectedly opened the file.\n");
42 return;
43 }
44 }
45
46 class TestInstance : public pp::Instance {
47 public:
48 explicit TestInstance(PP_Instance instance) : pp::Instance(instance) {}
49 virtual ~TestInstance() {}
50 virtual void HandleMessage(const pp::Var& var_message) {
51 if (!var_message.is_string()) {
52 return;
53 }
54 if (var_message.AsString() != "hello") {
55 return;
56 }
57 pp::Var reply = pp::Var(error);
58 PostMessage(reply);
59 }
60 };
61
62 class TestModule : public pp::Module {
63 public:
64 TestModule() : pp::Module() {}
65 virtual ~TestModule() {}
66
67 virtual pp::Instance* CreateInstance(PP_Instance instance) {
68 return new TestInstance(instance);
69 }
70 };
71
72 namespace pp {
73 Module* CreateModule() {
74 return new TestModule();
75 }
76 }
77
78 int main() {
79 load_manifest(&__nacl_irt_query);
80 return PpapiPluginMain();
81 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/nacl/manifest_file/irt_manifest_file_fail_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698