diff options
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/ppapi_sources.gypi | 2 | ||||
-rw-r--r-- | ppapi/tests/test_crash.cc | 26 | ||||
-rw-r--r-- | ppapi/tests/test_crash.h | 25 |
3 files changed, 53 insertions, 0 deletions
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 52d8e00..d35ff84 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -409,6 +409,8 @@ 'tests/test_console.h', 'tests/test_core.cc', 'tests/test_core.h', + 'tests/test_crash.cc', + 'tests/test_crash.h', 'tests/test_cursor_control.cc', 'tests/test_cursor_control.h', 'tests/test_empty.cc', 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_ |