summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 21:54:57 +0000
committerncbray@chromium.org <ncbray@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-13 21:54:57 +0000
commitc5c05b6ea4f01c3136e2daae5bff96ddf4e42906 (patch)
tree6d5640a5b9a49b0ce1f2a5d7c38d0d735cd41072 /ppapi/native_client
parent8c4a40dc81ea4379fbf7425a4fb7393b5f4d0aea (diff)
downloadchromium_src-c5c05b6ea4f01c3136e2daae5bff96ddf4e42906.zip
chromium_src-c5c05b6ea4f01c3136e2daae5bff96ddf4e42906.tar.gz
chromium_src-c5c05b6ea4f01c3136e2daae5bff96ddf4e42906.tar.bz2
Port crash test from nacl_integration to browser_tests.
BUG=154400 Review URL: https://codereview.chromium.org/114753005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240764 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/chrome_main.scons1
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/nacl.scons58
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash.html76
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_in_callback.cc34
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_off_main_thread.cc49
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc42
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_check_failure.cc24
-rw-r--r--ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_exit_call.cc26
8 files changed, 0 insertions, 310 deletions
diff --git a/ppapi/native_client/chrome_main.scons b/ppapi/native_client/chrome_main.scons
index 6e86f01..e8593a4 100644
--- a/ppapi/native_client/chrome_main.scons
+++ b/ppapi/native_client/chrome_main.scons
@@ -40,7 +40,6 @@ ppapi_scons_files['nonvariant_test_scons_files'] = [
'tests/nacl_browser/manifest_file/nacl.scons',
'tests/nacl_browser/nameservice/nacl.scons',
'tests/ppapi_browser/bad/nacl.scons',
- 'tests/ppapi_browser/crash/nacl.scons',
'tests/ppapi_browser/extension_mime_handler/nacl.scons',
'tests/ppapi_browser/manifest/nacl.scons',
'tests/ppapi_test_lib/nacl.scons',
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/nacl.scons b/ppapi/native_client/tests/ppapi_browser/crash/nacl.scons
deleted file mode 100644
index 924ca2a..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/nacl.scons
+++ /dev/null
@@ -1,58 +0,0 @@
-# -*- python -*-
-# Copyright (c) 2012 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.
-#
-# Tests fatal errors that occur after loading.
-# (See ppapi_browser/bad for fatal errors that occur during loading).
-#
-# The tests use ppapi_test_lib.
-
-Import('env')
-
-env.Prepend(CPPDEFINES=['XP_UNIX'])
-env.Replace(
- TEST_DIR='${SOURCE_ROOT}/ppapi/native_client/tests/ppapi_browser/crash')
-
-crash_types = ['via_check_failure',
- 'via_exit_call',
- 'in_callback',
- 'off_main_thread',
- 'ppapi_off_main_thread']
-published_files = []
-
-nmf_names = []
-for crash_type in crash_types:
- nexe = env.ProgramNameForNmf('ppapi_crash_%s' % crash_type)
- env.Alias('ppapi_crash_%s${PROGSUFFIX}' % crash_type,
- ['$STAGING_DIR/%s${PROGSUFFIX}' % nexe])
-
- env.ComponentProgram(
- nexe,
- ['ppapi_crash_%s.cc' % crash_type],
- EXTRA_LIBS=['ppapi',
- 'ppapi_test_lib',
- 'platform',
- 'pthread',
- 'gio'])
-
-# TODO(polina): follow ppapi_browser/bad nacl.scons to publish html only once
-# and to associate all nexes and nmf files with one target that can be
-# referenced in tests/nacl.scons.
- nmf_names.append('ppapi_crash_%s' % crash_type)
- env.Publish(nexe, 'run',
- ['ppapi_crash.html'])
-
- published_files.extend(env.ExtractPublishedFiles(nexe))
-
-node = env.PPAPIBrowserTester('ppapi_crash_browser_test.out',
- url='ppapi_crash.html',
- nmf_names=nmf_names,
- files=published_files)
-# This test is failing on Windows:
-# crbug.com/98721
-env.AddNodeToTestSuite(node,
- ['chrome_browser_tests'],
- 'run_ppapi_crash_browser_test',
- is_broken=env.PPAPIBrowserTesterIsBroken() or
- env.Bit('host_windows'))
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash.html b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash.html
deleted file mode 100644
index 1c4eadc..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <!-- Copyright (c) 2011 Google Inc. All rights reserved. -->
- <head>
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="-1" />
- <script type="text/javascript" src="nacltest.js"></script>
- <title>Nexe Crash Test</title>
- </head>
- <body>
- <h1>Nexe Crash Test</h1>
-
- <embed type="application/x-nacl" id="crash_via_check_failure"
- name="nacl_module"
- src="ppapi_crash_via_check_failure.nmf"
- width="0" height="0" />
- <embed type="application/x-nacl" id="crash_via_exit_call"
- name="nacl_module"
- src="ppapi_crash_via_exit_call.nmf"
- width="0" height="0" />
- <embed type="application/x-nacl" id="crash_in_callback"
- name="nacl_module"
- src="ppapi_crash_in_callback.nmf"
- width="0" height="0" />
- <embed type="application/x-nacl" id="crash_ppapi_off_main_thread"
- name="nacl_module"
- src="ppapi_crash_ppapi_off_main_thread.nmf"
- width="0" height="0" />
- <embed type="application/x-nacl" id="crash_off_main_thread"
- name="nacl_module"
- src="ppapi_crash_off_main_thread.nmf"
- width="0" height="0" />
-
- <script type="text/javascript">
- //<![CDATA[
- var tester = new Tester();
- function AddTest(plugin, testName, expectedEvent, unexpectedEvent,
- pingToDetectCrash) {
- tester.addAsyncTest(testName, function(test) {
- test.expectEvent(plugin, expectedEvent,
- function(e) { test.pass(); });
- test.expectEvent(plugin, unexpectedEvent,
- function(e) { test.fail(); });
- plugin.postMessage(testName);
- // In case the nexe does not crash right away, we will ping it
- // until we detect that it's dead. DidChangeView and other events
- // can do this too, but are less reliable.
- if (pingToDetectCrash) {
- function PingBack(message) {
- test.log(message.data);
- plugin.postMessage('Ping');
- }
- plugin.addEventListener('message', PingBack, false);
- plugin.postMessage("Ping");
- }
- });
- tester.waitFor(plugin);
- }
-
- AddTest($('crash_via_check_failure'),
- 'CrashViaCheckFailure', 'crash', 'error');
- AddTest($('crash_via_exit_call'),
- 'CrashViaExitCall', 'crash', 'error');
- AddTest($('crash_in_callback'),
- 'CrashInCallback', 'crash', 'error');
- AddTest($('crash_ppapi_off_main_thread'),
- 'CrashPPAPIOffMainThread', 'crash', 'error');
- AddTest($('crash_off_main_thread'),
- 'CrashOffMainThread', 'crash', 'error', true);
-
- tester.run();
- //]]>
- </script>
- </body>
-</html>
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_in_callback.cc b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_in_callback.cc
deleted file mode 100644
index b9f605b..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_in_callback.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/c/pp_errors.h"
-#include "ppapi/c/ppb_core.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
-
-
-namespace {
-
-void CrashingCallback(void* /*user_data*/, int32_t /*result*/) {
- printf("--- CrashingCallback\n");
- CRASH;
-}
-
-void CrashInCallback() {
- printf("--- CrashInCallback\n");
- PP_CompletionCallback callback =
- PP_MakeCompletionCallback(CrashingCallback, NULL);
- PPBCore()->CallOnMainThread(0 /*delay*/, callback, PP_OK);
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("CrashInCallback", CrashInCallback);
-}
-
-void SetupPluginInterfaces() {
- // none
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_off_main_thread.cc b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_off_main_thread.cc
deleted file mode 100644
index c69941c..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_off_main_thread.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (c) 2012 The Chromium 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 handle crashes on threads other than main.
-
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
-
-namespace {
-
-void* CrashOffMainThreadFunction(void* thread_arg) {
- printf("--- CrashOffMainThreadFunction\n");
- usleep(1000); // Try to wait until PPP_Messaging::HandleMessage returns.
- CRASH;
- return NULL;
-}
-
-// Depending on how the detached thread is scheduled, this will either crash
-// during PPP_Messaging::HandleMessage or after it and before the next PPP call.
-// If a crash occurs within a PPP call, it returns an RPC error.
-// If a crash occurs between PPP calls, the next call will return an RPC error.
-void CrashOffMainThread() {
- printf("--- CrashOffMainThread\n");
- pthread_t tid;
- pthread_create(&tid, NULL /*attr*/, CrashOffMainThreadFunction, NULL);
- pthread_detach(tid);
-}
-
-// This will allow us to ping the nexe to detect a crash that occured
-// while the main thread was waiting for the next PPP call.
-void Ping() {
- LOG_TO_BROWSER("ping received");
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("CrashOffMainThread", CrashOffMainThread);
- RegisterTest("Ping", Ping);
-}
-
-void SetupPluginInterfaces() {
- // none
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc
deleted file mode 100644
index 9583575..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_ppapi_off_main_thread.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 The Chromium 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 <pthread.h>
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/c/ppb_url_request_info.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/get_browser_interface.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
-
-namespace {
-
-void* CrashOffMainThreadFunction(void* thread_arg) {
- printf("--- CrashPPAPIOffMainThreadFunction\n");
- CRASH;
- 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
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_check_failure.cc b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_check_failure.cc
deleted file mode 100644
index 4635d4f..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_check_failure.cc
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
-
-namespace {
-
-// This will crash a PPP_Messaging function.
-void CrashViaCheckFailure() {
- printf("--- CrashViaCheckFailure\n");
- CHECK(false);
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("CrashViaCheckFailure", CrashViaCheckFailure);
-}
-
-void SetupPluginInterfaces() {
- // none
-}
diff --git a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_exit_call.cc b/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_exit_call.cc
deleted file mode 100644
index 1ff41a1..0000000
--- a/ppapi/native_client/tests/ppapi_browser/crash/ppapi_crash_via_exit_call.cc
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <unistd.h>
-
-#include "native_client/src/shared/platform/nacl_check.h"
-#include "ppapi/native_client/tests/ppapi_test_lib/test_interface.h"
-
-namespace {
-
-// This will crash a PPP_Messaging function.
-void CrashViaExitCall() {
- printf("--- CrashViaExitCall\n");
- _exit(0);
-}
-
-} // namespace
-
-void SetupTests() {
- RegisterTest("CrashViaExitCall", CrashViaExitCall);
-}
-
-void SetupPluginInterfaces() {
- // none
-}