Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / nacl / crash / ppapi_crash_ppapi_off_main_thread.cc
blob89c0794244bcd4a9a7df21f69be6946b071818a7
1 // Copyright 2013 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.
9 #include <pthread.h>
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"
16 namespace {
18 void* CrashOffMainThreadFunction(void* thread_arg) {
19 printf("--- CrashPPAPIOffMainThreadFunction\n");
20 CRASH;
21 return NULL;
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.
34 } // namespace
36 void SetupTests() {
37 RegisterTest("CrashPPAPIOffMainThread", CrashPPAPIOffMainThread);
40 void SetupPluginInterfaces() {
41 // none