immediate_crash_test_helper.cc 788 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2019 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. #include "base/immediate_crash.h" // nogncheck
  5. #if defined(WIN32)
  6. #define IMMEDIATE_CRASH_TEST_HELPER_EXPORT __declspec(dllexport)
  7. #else // defined(WIN32)
  8. #define IMMEDIATE_CRASH_TEST_HELPER_EXPORT \
  9. __attribute__((visibility("default")))
  10. #endif // defined(WIN32)
  11. extern "C" {
  12. IMMEDIATE_CRASH_TEST_HELPER_EXPORT int TestFunction1(int x, int y) {
  13. if (x < 1)
  14. IMMEDIATE_CRASH();
  15. if (y < 1)
  16. IMMEDIATE_CRASH();
  17. return x + y;
  18. }
  19. IMMEDIATE_CRASH_TEST_HELPER_EXPORT int TestFunction2(int x, int y) {
  20. if (x < 2)
  21. IMMEDIATE_CRASH();
  22. if (y < 2)
  23. IMMEDIATE_CRASH();
  24. return x * y;
  25. }
  26. } // extern "C"