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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/tests/test_hello.h ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_hello.cc
diff --git a/ppapi/tests/test_hello.cc b/ppapi/tests/test_hello.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fe6dfd68dfa9dd3400e779b0de792bae42fbda30
--- /dev/null
+++ b/ppapi/tests/test_hello.cc
@@ -0,0 +1,73 @@
+// 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 "ppapi/tests/test_hello.h"
+
+#include <stdio.h>
+#include <string.h>
+
+#include "base/logging.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/dev/ppb_hello_dev.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/dev/hello_dev.h"
+#include "ppapi/tests/test_utils.h"
+#include "ppapi/tests/testing_instance.h"
+
+REGISTER_TEST_CASE(Hello);
+
+TestHello::TestHello(TestingInstance* instance)
+ : TestCase(instance),
+ hello_interface_(NULL) {
+ LOG(ERROR) << "TestHello (constructor)";
+}
+
+bool TestHello::Init() {
+ hello_interface_ = static_cast<PPB_Hello_Dev const*>(
+ pp::Module::Get()->GetBrowserInterface(PPB_HELLO_DEV_INTERFACE));
+ LOG(ERROR) << "Init; hello_interface_ = " << hello_interface_;
+ return !!hello_interface_;
+}
+
+void TestHello::RunTest() {
+ RUN_TEST(Create);
+ RUN_TEST(SayHello);
+ RUN_TEST(WhoAreYou);
+}
+
+std::string TestHello::TestCreate() {
+ LOG(ERROR) << "TestCreate...";
+ pp::Hello hello(instance_);
+ if (hello.is_null())
+ return "Could not create hello";
+
+ PASS();
+}
+
+std::string TestHello::TestSayHello() {
+ LOG(ERROR) << "TestSayHello...";
+ pp::Hello hello(instance_);
+ if (hello.is_null()) {
+ LOG(ERROR) << "could not create heelo";
+ return "could not create hello";
+ }
+ int32_t rv = hello.SayHello();
+ ASSERT_EQ(PP_OK, rv);
+
+ PASS();
+}
+
+std::string TestHello::TestWhoAreYou() {
+ LOG(ERROR) << "TestWhoAreYou...";
+ pp::Hello hello(instance_);
+ if (hello.is_null()) {
+ LOG(ERROR) << "could not create heelo";
+ return "could not create hello";
+ }
+ char buffer[1024];
+ hello.WhoAreYou(buffer, 1024, pp::CompletionCallback());
+ printf("WhoAreYou: %s\n", buffer);
+
+ PASS();
+}
« 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