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

Side by Side Diff: ppapi/tests/test_hello.cc

Issue 8414054: Hello Pepper API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 | « ppapi/tests/test_hello.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('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 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ppapi/tests/test_hello.h"
6
7 #include <stdio.h>
8 #include <string.h>
9
10 #include "base/logging.h"
11 #include "ppapi/c/pp_errors.h"
12 #include "ppapi/c/dev/ppb_hello_dev.h"
13 #include "ppapi/cpp/completion_callback.h"
14 #include "ppapi/cpp/dev/hello_dev.h"
15 #include "ppapi/tests/test_utils.h"
16 #include "ppapi/tests/testing_instance.h"
17
18 REGISTER_TEST_CASE(Hello);
19
20 TestHello::TestHello(TestingInstance* instance)
21 : TestCase(instance),
22 hello_interface_(NULL) {
23 LOG(ERROR) << "TestHello (constructor)";
24 }
25
26 bool TestHello::Init() {
27 hello_interface_ = static_cast<PPB_Hello_Dev const*>(
28 pp::Module::Get()->GetBrowserInterface(PPB_HELLO_DEV_INTERFACE));
29 LOG(ERROR) << "Init; hello_interface_ = " << hello_interface_;
30 return !!hello_interface_;
31 }
32
33 void TestHello::RunTest() {
34 RUN_TEST(Create);
35 RUN_TEST(SayHello);
36 RUN_TEST(WhoAreYou);
37 }
38
39 std::string TestHello::TestCreate() {
40 LOG(ERROR) << "TestCreate...";
41 pp::Hello hello(instance_);
42 if (hello.is_null())
43 return "Could not create hello";
44
45 PASS();
46 }
47
48 std::string TestHello::TestSayHello() {
49 LOG(ERROR) << "TestSayHello...";
50 pp::Hello hello(instance_);
51 if (hello.is_null()) {
52 LOG(ERROR) << "could not create heelo";
53 return "could not create hello";
54 }
55 int32_t rv = hello.SayHello();
56 ASSERT_EQ(PP_OK, rv);
57
58 PASS();
59 }
60
61 std::string TestHello::TestWhoAreYou() {
62 LOG(ERROR) << "TestWhoAreYou...";
63 pp::Hello hello(instance_);
64 if (hello.is_null()) {
65 LOG(ERROR) << "could not create heelo";
66 return "could not create hello";
67 }
68 char buffer[1024];
69 hello.WhoAreYou(buffer, 1024, pp::CompletionCallback());
70 printf("WhoAreYou: %s\n", buffer);
71
72 PASS();
73 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_hello.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698