diff options
author | halyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 16:38:41 +0000 |
---|---|---|
committer | halyavin@google.com <halyavin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-31 16:38:41 +0000 |
commit | b39c6d963c4cd8668c12c2c1baaaed0d80b8cd04 (patch) | |
tree | 5f4a783da518a925342da2678974d6ea194ed30c /ppapi | |
parent | 5dd6281922b182b30e990514ecdc6ba52f599213 (diff) | |
download | chromium_src-b39c6d963c4cd8668c12c2c1baaaed0d80b8cd04.zip chromium_src-b39c6d963c4cd8668c12c2c1baaaed0d80b8cd04.tar.gz chromium_src-b39c6d963c4cd8668c12c2c1baaaed0d80b8cd04.tar.bz2 |
Chrome part of exception handling support. The debugger is attached when new chrome process
connects to the browser process but before start ipc message is sent. This is needed due
to windows bug when process crashes if debugger is attached before process is started.
BUG= http://code.google.com/p/nativeclient/issues/detail?id=2401
TEST= ui_tests --gtest_filter=NaClTestEnableHardwareExceptions.Exception
Review URL: http://codereview.chromium.org/8818008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/ppapi_sources.gypi | 1 | ||||
-rw-r--r-- | ppapi/tests/test_exception.cc | 47 | ||||
-rw-r--r-- | ppapi/tests/test_exception.h | 22 |
3 files changed, 70 insertions, 0 deletions
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index 5e9be70..2c7fb7b 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -308,6 +308,7 @@ 'tests/test_audio_config.cc', 'tests/test_cursor_control.cc', 'tests/test_directory_reader.cc', + 'tests/test_exception.cc', 'tests/test_file_io.cc', 'tests/test_file_ref.cc', 'tests/test_file_system.cc', diff --git a/ppapi/tests/test_exception.cc b/ppapi/tests/test_exception.cc new file mode 100644 index 0000000..3cd6bc8 --- /dev/null +++ b/ppapi/tests/test_exception.cc @@ -0,0 +1,47 @@ +// 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. + +// TODO(halyavin): Decide where non-PPAPI chrome tests should go and move this +// test there. Issue http://code.google.com/p/chromium/issues/detail?id=112057. + +#include "ppapi/tests/test_exception.h" + +#include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" +#include <sys/nacl_syscalls.h> +#include <setjmp.h> + +#include "ppapi/tests/testing_instance.h" + +REGISTER_TEST_CASE(Exception); + +jmp_buf env; + +TestException::TestException(TestingInstance* instance) + : TestCase(instance) { +} + +bool TestException::Init() { + return true; +} + +void TestException::RunTests(const std::string& filter) { +#if !defined(__x86_64__) && defined(__native_client__) + RUN_TEST(CatchException, filter); +#endif +} + +void handler(int eip, int esp) { + NACL_SYSCALL(exception_clear_flag)(); + longjmp(env, 1); +} + +std::string TestException::TestCatchException() { + if (setjmp(env)) { + PASS(); + } else { + NACL_SYSCALL(exception_handler)(handler, NULL); + *((int*)0) = 0; + } + return "exception is ignored"; +}
\ No newline at end of file diff --git a/ppapi/tests/test_exception.h b/ppapi/tests/test_exception.h new file mode 100644 index 0000000..0663fe3 --- /dev/null +++ b/ppapi/tests/test_exception.h @@ -0,0 +1,22 @@ +// 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. + +#ifndef PPAPI_TESTS_TEST_EXCEPTION_H_ +#define PPAPI_TESTS_TEST_EXCEPTION_H_ + +#include "ppapi/tests/test_case.h" + +class TestException : public TestCase { + public: + explicit TestException(TestingInstance* instance); + + // TestCase implementation. + virtual bool Init(); + virtual void RunTests(const std::string& filter); + + private: + std::string TestCatchException(); +}; + +#endif // PPAPI_TESTS_TEST_EXCEPTION_H_ |