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) |
| 78 // for the virtual keyboard. |
| 79 #if defined(TOUCH_UI) |
| 80 #define EXPECTED_ASSERT_ERRORS 2 |
| 81 #else |
| 82 #define EXPECTED_ASSERT_ERRORS 1 |
| 83 #endif |
| 84 |
77 #if !defined(NDEBUG) // We don't have assertions in release builds. | 85 #if !defined(NDEBUG) // We don't have assertions in release builds. |
78 // Tests whether we correctly fail on browser assertions during tests. | 86 // Tests whether we correctly fail on browser assertions during tests. |
79 class AssertionTest : public UITest { | 87 class AssertionTest : public UITest { |
80 protected: | 88 protected: |
81 AssertionTest() : UITest() { | 89 AssertionTest() : UITest() { |
82 // Initial loads will never complete due to assertion. | 90 // Initial loads will never complete due to assertion. |
83 wait_for_initial_loads_ = false; | 91 wait_for_initial_loads_ = false; |
84 | 92 |
85 // We're testing the renderer rather than the browser assertion here, | 93 // We're testing the renderer rather than the browser assertion here, |
86 // because the browser assertion would flunk the test during SetUp() | 94 // because the browser assertion would flunk the test during SetUp() |
87 // (since TAU wouldn't be able to find the browser window). | 95 // (since TAU wouldn't be able to find the browser window). |
88 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); | 96 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); |
89 } | 97 } |
90 }; | 98 }; |
91 | 99 |
92 // Launch the app in assertion test mode, then close the app. | 100 // Launch the app in assertion test mode, then close the app. |
93 #if defined(OS_WIN) | 101 #if defined(OS_WIN) |
94 // http://crbug.com/26715 | 102 // http://crbug.com/26715 |
95 #define Assertion DISABLED_Assertion | 103 #define Assertion DISABLED_Assertion |
96 #elif defined(OS_MACOSX) | 104 #elif defined(OS_MACOSX) |
97 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 105 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
98 #define Assertion DISABLED_Assertion | 106 #define Assertion DISABLED_Assertion |
99 #endif | 107 #endif |
100 TEST_F(AssertionTest, Assertion) { | 108 TEST_F(AssertionTest, Assertion) { |
101 if (ProxyLauncher::in_process_renderer()) { | 109 if (ProxyLauncher::in_process_renderer()) { |
102 // in process mode doesn't do the crashing. | 110 // in process mode doesn't do the crashing. |
103 expected_errors_ = 0; | 111 expected_errors_ = 0; |
104 expected_crashes_ = 0; | 112 expected_crashes_ = 0; |
105 } else { | 113 } else { |
106 expected_errors_ = 1; | 114 expected_errors_ = EXPECTED_ASSERT_ERRORS; |
107 expected_crashes_ = EXPECTED_ASSERT_CRASHES; | 115 expected_crashes_ = EXPECTED_ASSERT_CRASHES; |
108 } | 116 } |
109 } | 117 } |
110 #endif // !defined(NDEBUG) | 118 #endif // !defined(NDEBUG) |
111 | 119 |
112 #if !defined(OFFICIAL_BUILD) | 120 #if !defined(OFFICIAL_BUILD) |
113 // Only works on Linux in Release mode with CHROME_HEADLESS=1 | 121 // Only works on Linux in Release mode with CHROME_HEADLESS=1 |
114 class CheckFalseTest : public UITest { | 122 class CheckFalseTest : public UITest { |
115 protected: | 123 protected: |
116 CheckFalseTest() : UITest() { | 124 CheckFalseTest() : UITest() { |
(...skipping 14 matching lines...) Expand all Loading... |
131 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 | 139 // Crash service doesn't exist for the Mac yet: http://crbug.com/45243 |
132 #define CheckFails DISABLED_CheckFails | 140 #define CheckFails DISABLED_CheckFails |
133 #endif | 141 #endif |
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 |