| Index: ppapi/tests/extensions/packaged_app/test_packaged_app.cc
|
| diff --git a/ppapi/tests/extensions/packaged_app/test_packaged_app.cc b/ppapi/tests/extensions/packaged_app/test_packaged_app.cc
|
| index d375a934090d098d32f55ec497117b03b199c4fe..b74c979de33aed51a293da66b57794a6bacd36fd 100644
|
| --- a/ppapi/tests/extensions/packaged_app/test_packaged_app.cc
|
| +++ b/ppapi/tests/extensions/packaged_app/test_packaged_app.cc
|
| @@ -13,7 +13,9 @@
|
| #include "ppapi/cpp/completion_callback.h"
|
| #include "ppapi/cpp/instance.h"
|
| #include "ppapi/cpp/module.h"
|
| +#include "ppapi/cpp/tcp_socket.h"
|
| #include "ppapi/cpp/var.h"
|
| +#include "ppapi/utility/completion_callback_factory.h"
|
|
|
| namespace {
|
|
|
| @@ -99,7 +101,7 @@ void PostReply(void* user_data, int32_t status) {
|
| if (!g_last_error.empty())
|
| g_instance->PostMessage(g_last_error.c_str());
|
| else
|
| - g_instance->PostMessage("Test passed");
|
| + g_instance->PostMessage("PASS");
|
| }
|
|
|
| void* RunTestsOnBackgroundThread(void* thread_id) {
|
| @@ -111,11 +113,20 @@ void* RunTestsOnBackgroundThread(void* thread_id) {
|
|
|
| class MyInstance : public pp::Instance {
|
| public:
|
| - explicit MyInstance(PP_Instance instance) : pp::Instance(instance) {
|
| + explicit MyInstance(PP_Instance instance)
|
| + : pp::Instance(instance), socket_(this), factory_(this) {
|
| g_instance = this;
|
| }
|
| virtual ~MyInstance() { }
|
|
|
| + void DidBindSocket(int32_t result) {
|
| + // We didn't ask for socket permission in our manifest, so it should fail.
|
| + if (result == PP_ERROR_NOACCESS)
|
| + PostMessage("PASS");
|
| + else
|
| + PostMessage(result);
|
| + }
|
| +
|
| virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]) {
|
| pthread_t thread;
|
| // irt_open_resource() isn't allowed to be called on the main thread once
|
| @@ -124,8 +135,16 @@ class MyInstance : public pp::Instance {
|
| g_last_error = "pthread_create failed";
|
| PostReply(NULL, 0);
|
| }
|
| + // Attempt to bind a socket. We don't have permissions, so it should fail.
|
| + PP_NetAddress_IPv4 ipv4_address = {80, {127, 0, 0, 1} };
|
| + pp::NetAddress address(this, ipv4_address);
|
| + socket_.Bind(address, factory_.NewCallback(&MyInstance::DidBindSocket));
|
| return true;
|
| }
|
| +
|
| + private:
|
| + pp::TCPSocket socket_;
|
| + pp::CompletionCallbackFactory<MyInstance> factory_;
|
| };
|
|
|
| class MyModule : public pp::Module {
|
|
|