| 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();
|
| +}
|
|
|