| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <string> | 5 #include <string> |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 class AssertionTest : public UITest { | 65 class AssertionTest : public UITest { |
| 66 protected: | 66 protected: |
| 67 AssertionTest() : UITest() | 67 AssertionTest() : UITest() |
| 68 { | 68 { |
| 69 // Initial loads will never complete due to assertion. | 69 // Initial loads will never complete due to assertion. |
| 70 wait_for_initial_loads_ = false; | 70 wait_for_initial_loads_ = false; |
| 71 | 71 |
| 72 // We're testing the renderer rather than the browser assertion here, | 72 // We're testing the renderer rather than the browser assertion here, |
| 73 // because the browser assertion would flunk the test during SetUp() | 73 // because the browser assertion would flunk the test during SetUp() |
| 74 // (since TAU wouldn't be able to find the browser window). | 74 // (since TAU wouldn't be able to find the browser window). |
| 75 CommandLine::AppendSwitch(&launch_arguments_, | 75 launch_arguments_.AppendSwitch(switches::kRendererAssertTest); |
| 76 switches::kRendererAssertTest); | |
| 77 } | 76 } |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 // Launch the app in assertion test mode, then close the app. | 79 // Launch the app in assertion test mode, then close the app. |
| 81 TEST_F(AssertionTest, Assertion) { | 80 TEST_F(AssertionTest, Assertion) { |
| 82 if (UITest::in_process_renderer()) { | 81 if (UITest::in_process_renderer()) { |
| 83 // in process mode doesn't do the crashing. | 82 // in process mode doesn't do the crashing. |
| 84 expected_errors_ = 0; | 83 expected_errors_ = 0; |
| 85 expected_crashes_ = 0; | 84 expected_crashes_ = 0; |
| 86 } else { | 85 } else { |
| 87 expected_errors_ = 1; | 86 expected_errors_ = 1; |
| 88 expected_crashes_ = 1; | 87 expected_crashes_ = 1; |
| 89 } | 88 } |
| 90 } | 89 } |
| 91 #endif // NDEBUG | 90 #endif // NDEBUG |
| 92 | 91 |
| 93 // Tests whether we correctly fail on browser crashes during UI Tests. | 92 // Tests whether we correctly fail on browser crashes during UI Tests. |
| 94 class RendererCrashTest : public UITest { | 93 class RendererCrashTest : public UITest { |
| 95 protected: | 94 protected: |
| 96 RendererCrashTest() : UITest() | 95 RendererCrashTest() : UITest() |
| 97 { | 96 { |
| 98 // Initial loads will never complete due to crash. | 97 // Initial loads will never complete due to crash. |
| 99 wait_for_initial_loads_ = false; | 98 wait_for_initial_loads_ = false; |
| 100 | 99 |
| 101 CommandLine::AppendSwitch(&launch_arguments_, | 100 launch_arguments_.AppendSwitch(switches::kRendererCrashTest); |
| 102 switches::kRendererCrashTest); | |
| 103 } | 101 } |
| 104 }; | 102 }; |
| 105 | 103 |
| 106 // Launch the app in renderer crash test mode, then close the app. | 104 // Launch the app in renderer crash test mode, then close the app. |
| 107 TEST_F(RendererCrashTest, Crash) { | 105 TEST_F(RendererCrashTest, Crash) { |
| 108 if (UITest::in_process_renderer()) { | 106 if (UITest::in_process_renderer()) { |
| 109 // in process mode doesn't do the crashing. | 107 // in process mode doesn't do the crashing. |
| 110 expected_crashes_ = 0; | 108 expected_crashes_ = 0; |
| 111 } else { | 109 } else { |
| 112 // Wait while the process is writing the crash dump. | 110 // Wait while the process is writing the crash dump. |
| 113 Sleep(5000); | 111 Sleep(5000); |
| 114 expected_crashes_ = 1; | 112 expected_crashes_ = 1; |
| 115 } | 113 } |
| 116 } | 114 } |
| 117 | 115 |
| 118 // Tests whether we correctly fail on browser crashes during UI Tests. | 116 // Tests whether we correctly fail on browser crashes during UI Tests. |
| 119 class BrowserCrashTest : public UITest { | 117 class BrowserCrashTest : public UITest { |
| 120 protected: | 118 protected: |
| 121 BrowserCrashTest() : UITest() | 119 BrowserCrashTest() : UITest() |
| 122 { | 120 { |
| 123 // Initial loads will never complete due to crash. | 121 // Initial loads will never complete due to crash. |
| 124 wait_for_initial_loads_ = false; | 122 wait_for_initial_loads_ = false; |
| 125 | 123 |
| 126 CommandLine::AppendSwitch(&launch_arguments_, | 124 launch_arguments_.AppendSwitch(switches::kBrowserCrashTest); |
| 127 switches::kBrowserCrashTest); | |
| 128 } | 125 } |
| 129 }; | 126 }; |
| 130 | 127 |
| 131 // Launch the app in browser crash test mode. | 128 // Launch the app in browser crash test mode. |
| 132 // This test is disabled. See bug 1198934. | 129 // This test is disabled. See bug 1198934. |
| 133 TEST_F(BrowserCrashTest, DISABLED_Crash) { | 130 TEST_F(BrowserCrashTest, DISABLED_Crash) { |
| 134 // Wait while the process is writing the crash dump. | 131 // Wait while the process is writing the crash dump. |
| 135 Sleep(5000); | 132 Sleep(5000); |
| 136 expected_crashes_ = 1; | 133 expected_crashes_ = 1; |
| 137 } | 134 } |
| 138 | 135 |
| OLD | NEW |