Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Alexander Dunaev | 0521017 | 2022-01-19 19:43:09 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/test/base/in_process_browser_test.h" |
| 6 | #include "content/public/test/browser_test.h" |
| 7 | #include "ui/ozone/public/ozone_platform.h" |
| 8 | |
| 9 | namespace ui { |
| 10 | |
| 11 | // Configures the ozone platform so it would return an error early at the stage |
| 12 | // of initialisation. In such event, the browser should gracefully exit. |
| 13 | // See https://crbug.com/1280138. |
| 14 | class OzonePlatformTest : public InProcessBrowserTest { |
| 15 | public: |
| 16 | OzonePlatformTest() { |
| 17 | OzonePlatform::SetFailInitializeUIForTest(true); |
| 18 | set_expected_exit_code(1); |
| 19 | } |
| 20 | |
| 21 | ~OzonePlatformTest() override { |
| 22 | OzonePlatform::SetFailInitializeUIForTest(false); |
| 23 | } |
| 24 | }; |
| 25 | |
Alison Gale | 079e6e95 | 2024-04-16 22:00:30 | [diff] [blame] | 26 | // TODO(crbug.com/40901715) Flaky during teardown on linux ASan/LSan builder. |
Kuan Huang | 5b56659 | 2023-05-13 00:03:11 | [diff] [blame] | 27 | #if BUILDFLAG(IS_LINUX) && \ |
| 28 | (defined(ADDRESS_SANITIZER) || defined(LEAK_SANITIZER)) |
| 29 | #define MAYBE_ExitsGracefullyOnPlatormInitFailure \ |
| 30 | DISABLED_ExitsGracefullyOnPlatormInitFailure |
| 31 | #else |
| 32 | #define MAYBE_ExitsGracefullyOnPlatormInitFailure \ |
| 33 | ExitsGracefullyOnPlatormInitFailure |
| 34 | #endif |
| 35 | IN_PROC_BROWSER_TEST_F(OzonePlatformTest, |
| 36 | MAYBE_ExitsGracefullyOnPlatormInitFailure) { |
Alexander Dunaev | 0521017 | 2022-01-19 19:43:09 | [diff] [blame] | 37 | // This should never be hit. The browser is expected to exit before entering |
| 38 | // the test body. |
| 39 | ASSERT_TRUE(false); |
| 40 | } |
| 41 | |
| 42 | } // namespace ui |