| 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..208bc2cdfdcf8b6fdc3ad3fb28ab77afde55de16 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 {
|
|
|
| @@ -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("hello");
|
| + 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 {
|
|
|