Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 #if defined(OS_LINUX) && (!defined(NDEBUG) || !defined(USE_LINUX_BREAKPAD)) | 68 #if defined(OS_LINUX) && (!defined(NDEBUG) || !defined(USE_LINUX_BREAKPAD)) |
| 69 // On Linux in Debug mode, Chrome generates a SIGTRAP. | 69 // On Linux in Debug mode, Chrome generates a SIGTRAP. |
| 70 // we do not catch SIGTRAPs, thus no crash dump. | 70 // we do not catch SIGTRAPs, thus no crash dump. |
| 71 // This also does not work if Breakpad is disabled. | 71 // This also does not work if Breakpad is disabled. |
| 72 #define EXPECTED_ASSERT_CRASHES 0 | 72 #define EXPECTED_ASSERT_CRASHES 0 |
| 73 #else | 73 #else |
| 74 #define EXPECTED_ASSERT_CRASHES 1 | 74 #define EXPECTED_ASSERT_CRASHES 1 |
| 75 #endif | 75 #endif |
| 76 | 76 |
| 77 // Touch build will start an extra renderer process (the extension process) | |
|
sadrul
2011/05/25 19:05:23
" for the keyboard"
Yufeng Shen (Slow to review)
2011/05/25 19:13:07
Done.
| |
| 78 #if defined(TOUCH_UI) | |
| 79 #define EXPECTED_ASSERT_ERRORS 2 | |
| 80 #else | |
| 81 #define EXPECTED_ASSERT_ERRORS 1 | |
| 82 #endif | |
| 83 | |
| 77 #if !defined(NDEBUG) // We don't have assertions in release builds. | 84 #if !defined(NDEBUG) // We don't have assertions in release builds. |
| 78 // Tests whether we correctly fail on browser assertions during tests. | 85 // Tests whether we correctly fail on browser assertions during tests. |
| 79 class AssertionTest : public UITest { | 86 class AssertionTest : public UITest { |
| 80 protected: | 87 protected: |
| 81 AssertionTest() : UITest() { | 88 AssertionTest() : UITest() { |
| 82 // Initial loads will never complete due to assertion. | 89 // Initial loads will never complete due to assertion. |
| 83 wait_for_initial_loads_ = false; | 90 wait_for_initial_loads_ = false; |
| 84 | 91 |
| 85 // We're testing the renderer rather than the browser assertion here, | 92 // We're testing the renderer rather than the browser assertion here, |
| 86 // because the browser assertion would flunk the test during SetUp() | 93 // because the browser assertion would flunk the test during SetUp() |
| 87 // (since TAU wouldn't be able to find the browser window). | 94 // (since TAU wouldn't be able to find the browser window). |
| 88 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); | 95 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); |
| 89 } | 96 } |
| 90 }; | 97 }; |
| 91 | 98 |
| 92 // Launch the app in assertion test mode, then close the app. | 99 // Launch the app in assertion test mode, then close the app. |
| 93 #if defined(OS_WIN) | 100 #if defined(OS_WIN) |
| 94 // http://crbug.com/26715 | 101 // http://crbug.com/26715 |
| 95 #define Assertion DISABLED_Assertion | 102 #define Assertion DISABLED_Assertion |
| 96 #elif defined(OS_MACOSX) | 103 #elif defined(OS_MACOSX) |
| 97 // 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 |
| 98 #define Assertion DISABLED_Assertion | 105 #define Assertion DISABLED_Assertion |
| 99 #endif | 106 #endif |
| 100 TEST_F(AssertionTest, Assertion) { | 107 TEST_F(AssertionTest, Assertion) { |
| 101 if (ProxyLauncher::in_process_renderer()) { | 108 if (ProxyLauncher::in_process_renderer()) { |
| 102 // in process mode doesn't do the crashing. | 109 // in process mode doesn't do the crashing. |
| 103 expected_errors_ = 0; | 110 expected_errors_ = 0; |
| 104 expected_crashes_ = 0; | 111 expected_crashes_ = 0; |
| 105 } else { | 112 } else { |
| 106 expected_errors_ = 1; | 113 expected_errors_ = EXPECTED_ASSERT_ERRORS; |
| 107 expected_crashes_ = EXPECTED_ASSERT_CRASHES; | 114 expected_crashes_ = EXPECTED_ASSERT_CRASHES; |
| 108 } | 115 } |
| 109 } | 116 } |
| 110 #endif // !defined(NDEBUG) | 117 #endif // !defined(NDEBUG) |
| 111 | 118 |
| 112 #if !defined(OFFICIAL_BUILD) | 119 #if !defined(OFFICIAL_BUILD) |
| 113 // Only works on Linux in Release mode with CHROME_HEADLESS=1 | 120 // Only works on Linux in Release mode with CHROME_HEADLESS=1 |
| 114 class CheckFalseTest : public UITest { | 121 class CheckFalseTest : public UITest { |
| 115 protected: | 122 protected: |
| 116 CheckFalseTest() : UITest() { | 123 CheckFalseTest() : UITest() { |
| 117 // Initial loads will never complete due to assertion. | 124 // Initial loads will never complete due to assertion. |
| 118 wait_for_initial_loads_ = false; | 125 wait_for_initial_loads_ = false; |
| 119 | 126 |
| 120 // We're testing the renderer rather than the browser assertion here, | 127 // We're testing the renderer rather than the browser assertion here, |
| 121 // because the browser assertion would flunk the test during SetUp() | 128 // because the browser assertion would flunk the test during SetUp() |
| 122 // (since TAU wouldn't be able to find the browser window). | 129 // (since TAU wouldn't be able to find the browser window). |
| 123 launch_arguments_.AppendSwitch(switches::kRendererCheckFalseTest); | 130 launch_arguments_.AppendSwitch(switches::kRendererCheckFalseTest); |
| 124 } | 131 } |
| 125 }; | 132 }; |
| 126 | 133 |
| 127 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
| 128 // http://crbug.com/38497 | 135 // http://crbug.com/38497 |
| 129 #define CheckFails FLAKY_CheckFails | 136 #define CheckFails FLAKY_CheckFails |
| 130 #elif defined(OS_MACOSX) | 137 #elif defined(OS_MACOSX) |
| 131 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 138 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
| 132 #define CheckFails DISABLED_CheckFails | 139 #define CheckFails DISABLED_CheckFails |
| 133 #endif | 140 #endif |
| 141 | |
|
sadrul
2011/05/25 19:05:23
-new line
Yufeng Shen (Slow to review)
2011/05/25 19:13:07
Done.
| |
| 134 // Launch the app in assertion test mode, then close the app. | 142 // Launch the app in assertion test mode, then close the app. |
| 135 TEST_F(CheckFalseTest, CheckFails) { | 143 TEST_F(CheckFalseTest, CheckFails) { |
| 136 if (ProxyLauncher::in_process_renderer()) { | 144 if (ProxyLauncher::in_process_renderer()) { |
| 137 // in process mode doesn't do the crashing. | 145 // in process mode doesn't do the crashing. |
| 138 expected_errors_ = 0; | 146 expected_errors_ = 0; |
| 139 expected_crashes_ = 0; | 147 expected_crashes_ = 0; |
| 140 } else { | 148 } else { |
| 141 expected_errors_ = 1; | 149 expected_errors_ = EXPECTED_ASSERT_ERRORS; |
| 142 expected_crashes_ = EXPECTED_ASSERT_CRASHES; | 150 expected_crashes_ = EXPECTED_ASSERT_CRASHES; |
| 143 } | 151 } |
| 144 } | 152 } |
| 145 #endif // !defined(OFFICIAL_BUILD) | 153 #endif // !defined(OFFICIAL_BUILD) |
| 146 | 154 |
| 147 // Tests whether we correctly fail on browser crashes during UI Tests. | 155 // Tests whether we correctly fail on browser crashes during UI Tests. |
| 148 class RendererCrashTest : public UITest { | 156 class RendererCrashTest : public UITest { |
| 149 protected: | 157 protected: |
| 150 RendererCrashTest() : UITest() { | 158 RendererCrashTest() : UITest() { |
| 151 // Initial loads will never complete due to crash. | 159 // Initial loads will never complete due to crash. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 174 if (ProxyLauncher::in_process_renderer()) { | 182 if (ProxyLauncher::in_process_renderer()) { |
| 175 // in process mode doesn't do the crashing. | 183 // in process mode doesn't do the crashing. |
| 176 expected_crashes_ = 0; | 184 expected_crashes_ = 0; |
| 177 } else { | 185 } else { |
| 178 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 186 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 179 ASSERT_TRUE(browser.get()); | 187 ASSERT_TRUE(browser.get()); |
| 180 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); | 188 ASSERT_TRUE(browser->WaitForTabCountToBecome(1)); |
| 181 expected_crashes_ = EXPECTED_CRASH_CRASHES; | 189 expected_crashes_ = EXPECTED_CRASH_CRASHES; |
| 182 } | 190 } |
| 183 } | 191 } |
| OLD | NEW |