| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // Touch build will start an extra renderer process (the extension process) | 78 // Touch build will start an extra renderer process (the extension process) |
| 79 // for the virtual keyboard. | 79 // for the virtual keyboard. |
| 80 #if defined(TOUCH_UI) | 80 #if defined(TOUCH_UI) |
| 81 #define EXPECTED_ASSERT_ERRORS 2 | 81 #define EXPECTED_ASSERT_ERRORS 2 |
| 82 #else | 82 #else |
| 83 #define EXPECTED_ASSERT_ERRORS 1 | 83 #define EXPECTED_ASSERT_ERRORS 1 |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 #if !defined(NDEBUG) // We don't have assertions in release builds. | 86 #if !defined(NDEBUG) // We don't have assertions in release builds. |
| 87 // Tests whether we correctly fail on browser assertions during tests. | 87 // Tests whether we correctly fail on renderer assertions during tests. |
| 88 class AssertionTest : public UITest { | 88 class AssertionTest : public UITest { |
| 89 protected: | 89 protected: |
| 90 AssertionTest() : UITest() { | 90 AssertionTest() { |
| 91 // Initial loads will never complete due to assertion. | 91 #if defined(OS_WIN) |
| 92 // TODO(phajdan.jr): Make crash notifications on launch work on Win. |
| 92 wait_for_initial_loads_ = false; | 93 wait_for_initial_loads_ = false; |
| 93 | 94 #endif |
| 94 // We're testing the renderer rather than the browser assertion here, | |
| 95 // because the browser assertion would flunk the test during SetUp() | |
| 96 // (since TAU wouldn't be able to find the browser window). | |
| 97 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); | 95 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); |
| 98 } | 96 } |
| 99 }; | 97 }; |
| 100 | 98 |
| 101 // Launch the app in assertion test mode, then close the app. | 99 // Launch the app in assertion test mode, then close the app. |
| 102 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 103 // http://crbug.com/26715 | 101 // http://crbug.com/26715 |
| 104 #define Assertion DISABLED_Assertion | 102 #define Assertion DISABLED_Assertion |
| 105 #elif defined(OS_MACOSX) | 103 #elif defined(OS_MACOSX) |
| 106 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 104 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
| 107 #define Assertion DISABLED_Assertion | 105 #define Assertion DISABLED_Assertion |
| 108 #endif | 106 #endif |
| 109 TEST_F(AssertionTest, Assertion) { | 107 TEST_F(AssertionTest, Assertion) { |
| 110 expected_errors_ = EXPECTED_ASSERT_ERRORS; | 108 expected_errors_ = EXPECTED_ASSERT_ERRORS; |
| 111 expected_crashes_ = EXPECTED_ASSERT_CRASHES; | 109 expected_crashes_ = EXPECTED_ASSERT_CRASHES; |
| 112 } | 110 } |
| 113 #endif // !defined(NDEBUG) | 111 #endif // !defined(NDEBUG) |
| 114 | 112 |
| 115 #if !defined(OFFICIAL_BUILD) | 113 #if !defined(OFFICIAL_BUILD) |
| 116 // Only works on Linux in Release mode with CHROME_HEADLESS=1 | 114 // Only works on Linux in Release mode with CHROME_HEADLESS=1 |
| 117 class CheckFalseTest : public UITest { | 115 class CheckFalseTest : public UITest { |
| 118 protected: | 116 protected: |
| 119 CheckFalseTest() : UITest() { | 117 CheckFalseTest() { |
| 120 // Initial loads will never complete due to assertion. | 118 #if defined(OS_WIN) |
| 119 // TODO(phajdan.jr): Make crash notifications on launch work on Win. |
| 121 wait_for_initial_loads_ = false; | 120 wait_for_initial_loads_ = false; |
| 122 | 121 #endif |
| 123 // We're testing the renderer rather than the browser assertion here, | |
| 124 // because the browser assertion would flunk the test during SetUp() | |
| 125 // (since TAU wouldn't be able to find the browser window). | |
| 126 launch_arguments_.AppendSwitch(switches::kRendererCheckFalseTest); | 122 launch_arguments_.AppendSwitch(switches::kRendererCheckFalseTest); |
| 127 } | 123 } |
| 128 }; | 124 }; |
| 129 | 125 |
| 130 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 131 // http://crbug.com/38497 | 127 // http://crbug.com/38497 |
| 132 #define CheckFails FLAKY_CheckFails | 128 #define CheckFails FLAKY_CheckFails |
| 133 #elif defined(OS_MACOSX) | 129 #elif defined(OS_MACOSX) |
| 134 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 130 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
| 135 #define CheckFails DISABLED_CheckFails | 131 #define CheckFails DISABLED_CheckFails |
| 136 #endif | 132 #endif |
| 137 // Launch the app in assertion test mode, then close the app. | 133 // Launch the app in assertion test mode, then close the app. |
| 138 TEST_F(CheckFalseTest, CheckFails) { | 134 TEST_F(CheckFalseTest, CheckFails) { |
| 139 expected_errors_ = EXPECTED_ASSERT_ERRORS; | 135 expected_errors_ = EXPECTED_ASSERT_ERRORS; |
| 140 expected_crashes_ = EXPECTED_ASSERT_CRASHES; | 136 expected_crashes_ = EXPECTED_ASSERT_CRASHES; |
| 141 } | 137 } |
| 142 #endif // !defined(OFFICIAL_BUILD) | 138 #endif // !defined(OFFICIAL_BUILD) |
| 143 | 139 |
| 144 // Tests whether we correctly fail on browser crashes during UI Tests. | 140 // Tests whether we correctly fail on browser crashes during UI Tests. |
| 145 class RendererCrashTest : public UITest { | 141 class RendererCrashTest : public UITest { |
| 146 protected: | 142 protected: |
| 147 RendererCrashTest() : UITest() { | 143 RendererCrashTest() { |
| 148 // Initial loads will never complete due to crash. | 144 #if defined(OS_WIN) |
| 145 // TODO(phajdan.jr): Make crash notifications on launch work on Win. |
| 149 wait_for_initial_loads_ = false; | 146 wait_for_initial_loads_ = false; |
| 150 | 147 #endif |
| 151 launch_arguments_.AppendSwitch(switches::kRendererCrashTest); | 148 launch_arguments_.AppendSwitch(switches::kRendererCrashTest); |
| 152 } | 149 } |
| 153 }; | 150 }; |
| 154 | 151 |
| 155 #if defined(OS_LINUX) && !defined(USE_LINUX_BREAKPAD) | 152 #if defined(OS_LINUX) && !defined(USE_LINUX_BREAKPAD) |
| 156 // On Linux, do not expect a crash dump if Breakpad is disabled. | 153 // On Linux, do not expect a crash dump if Breakpad is disabled. |
| 157 #define EXPECTED_CRASH_CRASHES 0 | 154 #define EXPECTED_CRASH_CRASHES 0 |
| 158 #else | 155 #else |
| 159 #define EXPECTED_CRASH_CRASHES 1 | 156 #define EXPECTED_CRASH_CRASHES 1 |
| 160 #endif | 157 #endif |
| 161 | 158 |
| 162 #if defined(OS_MACOSX) | 159 #if defined(OS_MACOSX) |
| 163 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 160 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
| 164 #define Crash DISABLED_Crash | 161 #define Crash DISABLED_Crash |
| 165 #endif | 162 #endif |
| 166 // Launch the app in renderer crash test mode, then close the app. | 163 // Launch the app in renderer crash test mode, then close the app. |
| 167 TEST_F(RendererCrashTest, Crash) { | 164 TEST_F(RendererCrashTest, Crash) { |
| 168 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 165 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 169 ASSERT_TRUE(browser.get()); | 166 ASSERT_TRUE(browser.get()); |
| 170 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); | 167 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); |
| 171 expected_crashes_ = EXPECTED_CRASH_CRASHES; | 168 expected_crashes_ = EXPECTED_CRASH_CRASHES; |
| 172 } | 169 } |
| OLD | NEW |