| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #if defined(OS_POSIX) | 5 #if defined(OS_POSIX) |
| 6 #include <signal.h> | 6 #include <signal.h> |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 content::WindowedNotificationObserver window_observer( | 171 content::WindowedNotificationObserver window_observer( |
| 172 chrome::NOTIFICATION_BROWSER_CLOSED, | 172 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 173 content::NotificationService::AllSources()); | 173 content::NotificationService::AllSources()); |
| 174 chrome::CloseWindow(browser()); | 174 chrome::CloseWindow(browser()); |
| 175 window_observer.Wait(); | 175 window_observer.Wait(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // If |accept| is true, simulates user clicking OK, otherwise simulates | 178 // If |accept| is true, simulates user clicking OK, otherwise simulates |
| 179 // clicking Cancel. | 179 // clicking Cancel. |
| 180 void ClickModalDialogButton(bool accept) { | 180 void ClickModalDialogButton(bool accept) { |
| 181 AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); | 181 app_modal_dialogs::AppModalDialog* dialog = |
| 182 ui_test_utils::WaitForAppModalDialog(); |
| 182 ASSERT_TRUE(dialog->IsJavaScriptModalDialog()); | 183 ASSERT_TRUE(dialog->IsJavaScriptModalDialog()); |
| 183 JavaScriptAppModalDialog* js_dialog = | 184 app_modal_dialogs::JavaScriptAppModalDialog* js_dialog = |
| 184 static_cast<JavaScriptAppModalDialog*>(dialog); | 185 static_cast<app_modal_dialogs::JavaScriptAppModalDialog*>(dialog); |
| 185 if (accept) | 186 if (accept) |
| 186 js_dialog->native_dialog()->AcceptAppModalDialog(); | 187 js_dialog->native_dialog()->AcceptAppModalDialog(); |
| 187 else | 188 else |
| 188 js_dialog->native_dialog()->CancelAppModalDialog(); | 189 js_dialog->native_dialog()->CancelAppModalDialog(); |
| 189 } | 190 } |
| 190 }; | 191 }; |
| 191 | 192 |
| 192 // Navigate to a page with an infinite unload handler. | 193 // Navigate to a page with an infinite unload handler. |
| 193 // Then two async crosssite requests to ensure | 194 // Then two async crosssite requests to ensure |
| 194 // we don't get confused and think we're closing the tab. | 195 // we don't get confused and think we're closing the tab. |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 content::WindowedNotificationObserver window_observer( | 631 content::WindowedNotificationObserver window_observer( |
| 631 chrome::NOTIFICATION_BROWSER_CLOSED, | 632 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 632 content::NotificationService::AllSources()); | 633 content::NotificationService::AllSources()); |
| 633 chrome::CloseWindow(browser()); | 634 chrome::CloseWindow(browser()); |
| 634 CrashTab(beforeunload_contents); | 635 CrashTab(beforeunload_contents); |
| 635 window_observer.Wait(); | 636 window_observer.Wait(); |
| 636 } | 637 } |
| 637 | 638 |
| 638 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 639 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
| 639 // and multiple windows. | 640 // and multiple windows. |
| OLD | NEW |