diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 05:20:52 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-08 05:20:52 +0000 |
commit | 4bf7ca2fd00ac20b5c9b0c7fe08840057bf99487 (patch) | |
tree | 9d5c73a8342fae01339be0680ff456bc9f3bec66 /ppapi/tests | |
parent | 94d1f49c77475b51c165f315ec2bb693f918bc68 (diff) | |
download | chromium_src-4bf7ca2fd00ac20b5c9b0c7fe08840057bf99487.zip chromium_src-4bf7ca2fd00ac20b5c9b0c7fe08840057bf99487.tar.gz chromium_src-4bf7ca2fd00ac20b5c9b0c7fe08840057bf99487.tar.bz2 |
PPAPI: Add a test to make sure we detect crashes
And bonus check that other tests *don't* crash. (Though it should be very rare that a test results in "PASS" and still crashes)
Earlier patchsets have a fix for 244900, but we decided not to fix that. Because of 244900, we don't detect crashes on shutdown... so this doesn't actually cause test failures for 243118. But it's useful to make sure we don't regress on showing the infobar in crashes that happen prior to shutdown.
BUG=244900,243118,247128
Review URL: https://codereview.chromium.org/16114007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_crash.cc | 26 | ||||
-rw-r--r-- | ppapi/tests/test_crash.h | 25 |
2 files changed, 51 insertions, 0 deletions
diff --git a/ppapi/tests/test_crash.cc b/ppapi/tests/test_crash.cc new file mode 100644 index 0000000..22f7772 --- /dev/null +++ b/ppapi/tests/test_crash.cc @@ -0,0 +1,26 @@ +// Copyright 2013 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 <stdlib.h> + +#include "ppapi/tests/test_crash.h" +#include "ppapi/tests/testing_instance.h" + +REGISTER_TEST_CASE(Crash); + +TestCrash::TestCrash(TestingInstance* instance) + : TestCase(instance) { +} + +void TestCrash::RunTests(const std::string& filter) { + RUN_TEST(CrashInCallOnMainThread, filter); +} + +std::string TestCrash::TestCrashInCallOnMainThread() { + // The tests are run via CallOnMainThread (see DidChangeView in + // TestingInstance), so we just crash here. + abort(); + PASS(); +} + diff --git a/ppapi/tests/test_crash.h b/ppapi/tests/test_crash.h new file mode 100644 index 0000000..ed6af8c --- /dev/null +++ b/ppapi/tests/test_crash.h @@ -0,0 +1,25 @@ +// Copyright 2013 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. + +#ifndef PPAPI_TESTS_TEST_CRASH_H_ +#define PPAPI_TESTS_TEST_CRASH_H_ + +#include <string> + +#include "ppapi/tests/test_case.h" + +// This test crashes at different points, allowing us to make sure the browser +// detects the crashes. +class TestCrash : public TestCase { + public: + explicit TestCrash(TestingInstance* instance); + + private: + // TestCase implementation. + virtual void RunTests(const std::string& filter); + + std::string TestCrashInCallOnMainThread(); +}; + +#endif // PPAPI_TESTS_TEST_CRASH_H_ |