1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 // 5 // Test that we kill the nexe on a CHECK and handle it gracefully on the 6 // trusted side when untrusted code makes unsupported PPAPI calls 7 // on other than the main thread. 8 9 #include <pthread.h> 10 11 #include "native_client/src/shared/platform/nacl_check.h" 12 #include "ppapi/c/ppb_url_request_info.h" 13 #include "ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h" 14 #include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h" 15 16 namespace { 17 18 void* CrashOffMainThreadFunction(void* thread_arg) { 19 printf("--- CrashPPAPIOffMainThreadFunction\n"); 20 CRASH; 21 return NULL; 22 } 23 24 25 // This will crash PPP_Messaging::HandleMessage. 26 void CrashPPAPIOffMainThread() { 27 printf("--- CrashPPAPIOffMainThread\n"); 28 pthread_t tid; 29 void* thread_result; 30 pthread_create(&tid, NULL /*attr*/, CrashOffMainThreadFunction, NULL); 31 pthread_join(tid, &thread_result); // Wait for the thread to crash. 32 } 33 34 } // namespace 35 36 void SetupTests() { 37 RegisterTest("CrashPPAPIOffMainThread", CrashPPAPIOffMainThread); 38 } 39 40 void SetupPluginInterfaces() { 41 // none 42 } 43