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

Unified Diff: ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc

Issue 7741036: NaCl PPAPI Proxy: wrap up with crash detection. Clean-up handling code to skip remote shutdown ca... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
Index: ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc
===================================================================
--- ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc (revision 0)
+++ ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc (revision 0)
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Native Client Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Test that we kill the nexe on a CHECK and handle it gracefully on the
+// trusted side when untrusted code makes unsupported PPAPI calls
+// on other than the main thread.
+
+#include "native_client/src/shared/platform/nacl_check.h"
+#include "native_client/tests/ppapi_test_lib/get_browser_interface.h"
+#include "native_client/tests/ppapi_test_lib/test_interface.h"
+#include "ppapi/c/ppb_url_request_info.h"
+
+namespace {
+
+void* CrashOffMainThreadFunction(void* thread_arg) {
+ printf("--- CrashPPAPIOffMainThreadFunction\n");
+ PPBURLRequestInfo()->Create(pp_instance()); // Fatal CHECK failure.
+ return NULL;
+}
+
+
+// This will crash PPP_Messaging::HandleMessage.
+void CrashPPAPIOffMainThread() {
+ printf("--- CrashPPAPIOffMainThread\n");
+ pthread_t tid;
+ void* thread_result;
+ pthread_create(&tid, NULL /*attr*/, CrashOffMainThreadFunction, NULL);
+ pthread_join(tid, &thread_result); // Wait for the thread to crash.
+}
+
+} // namespace
+
+void SetupTests() {
+ RegisterTest("CrashPPAPIOffMainThread", CrashPPAPIOffMainThread);
+}
+
+void SetupPluginInterfaces() {
+ // none
+}

Powered by Google App Engine
This is Rietveld 408576698