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

Unified Diff: ppapi/tests/test_message_handler.cc

Issue 600553002: PPAPI: Disallow blocking callbacks while handling a blocking message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try to improve comment Created 6 years, 3 months 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/shared_impl/ppb_message_loop_shared.h ('k') | ppapi/thunk/enter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_message_handler.cc
diff --git a/ppapi/tests/test_message_handler.cc b/ppapi/tests/test_message_handler.cc
index c5c8354fd9bd09ee90571d4b97bcf93b66f8aa5b..0483a6b0cd499f4ec52fd0468c5ad225f083b42f 100644
--- a/ppapi/tests/test_message_handler.cc
+++ b/ppapi/tests/test_message_handler.cc
@@ -13,12 +13,15 @@
#include "ppapi/c/ppb_file_io.h"
#include "ppapi/c/ppb_messaging.h"
#include "ppapi/c/ppp_message_handler.h"
+#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/file_io.h"
#include "ppapi/cpp/file_ref.h"
#include "ppapi/cpp/file_system.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/message_handler.h"
#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/network_list.h"
+#include "ppapi/cpp/network_monitor.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/var_array.h"
#include "ppapi/cpp/var_array_buffer.h"
@@ -122,6 +125,17 @@ class EchoingMessageHandler : public pp::MessageHandler {
if (instance.pp_instance() != testing_instance_->pp_instance())
AddError("HandleBlockingMessage was passed the wrong instance!");
+ // Attempt a blocking operation; make sure it's disallowed.
+ pp::NetworkMonitor monitor(instance);
+ PP_Resource out_param = 0;
+ pp::CompletionCallbackWithOutput<pp::NetworkList> blocking_callback(
+ &out_param);
+ int32_t error = monitor.UpdateNetworkList(blocking_callback);
+ if (error != PP_ERROR_WOULD_BLOCK_THREAD) {
+ AddError("HandleBlockingMessage was allowed to do a blocking call!");
+ pp::Module::Get()->core()->ReleaseResource(out_param);
+ }
+
return var;
}
« no previous file with comments | « ppapi/shared_impl/ppb_message_loop_shared.h ('k') | ppapi/thunk/enter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698