| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/lifetime/browser_close_manager.h" | 5 #include "chrome/browser/lifetime/browser_close_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "net/test/url_request/url_request_mock_http_job.h" | 57 #include "net/test/url_request/url_request_mock_http_job.h" |
| 58 #include "net/test/url_request/url_request_slow_download_job.h" | 58 #include "net/test/url_request/url_request_slow_download_job.h" |
| 59 | 59 |
| 60 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 61 #include "chromeos/chromeos_switches.h" | 61 #include "chromeos/chromeos_switches.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 namespace { | 64 namespace { |
| 65 | 65 |
| 66 app_modal::NativeAppModalDialog* GetNextDialog() { | 66 app_modal::NativeAppModalDialog* GetNextDialog() { |
| 67 app_modal::AppModalDialog* dialog = ui_test_utils::WaitForAppModalDialog(); | 67 app_modal::JavaScriptAppModalDialog* dialog = |
| 68 EXPECT_TRUE(dialog->IsJavaScriptModalDialog()); | 68 ui_test_utils::WaitForAppModalDialog(); |
| 69 app_modal::JavaScriptAppModalDialog* js_dialog = | 69 CHECK(dialog->native_dialog()); |
| 70 static_cast<app_modal::JavaScriptAppModalDialog*>(dialog); | 70 return dialog->native_dialog(); |
| 71 CHECK(js_dialog->native_dialog()); | |
| 72 return js_dialog->native_dialog(); | |
| 73 } | 71 } |
| 74 | 72 |
| 75 // Note: call |PrepareForDialog| on the relevant WebContents or Browser before | 73 // Note: call |PrepareForDialog| on the relevant WebContents or Browser before |
| 76 // trying to close it, to avoid flakiness. https://crbug.com/519646 | 74 // trying to close it, to avoid flakiness. https://crbug.com/519646 |
| 77 void AcceptClose() { | 75 void AcceptClose() { |
| 78 GetNextDialog()->AcceptAppModalDialog(); | 76 GetNextDialog()->AcceptAppModalDialog(); |
| 79 } | 77 } |
| 80 | 78 |
| 81 // Note: call |PrepareForDialog| on the relevant WebContents or Browser before | 79 // Note: call |PrepareForDialog| on the relevant WebContents or Browser before |
| 82 // trying to close it, to avoid flakiness. https://crbug.com/519646 | 80 // trying to close it, to avoid flakiness. https://crbug.com/519646 |
| (...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 | 1334 |
| 1337 chrome::CloseAllBrowsers(); | 1335 chrome::CloseAllBrowsers(); |
| 1338 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); | 1336 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); |
| 1339 EXPECT_TRUE(BrowserList::GetInstance()->empty()); | 1337 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
| 1340 EXPECT_TRUE(IsBackgroundModeSuspended()); | 1338 EXPECT_TRUE(IsBackgroundModeSuspended()); |
| 1341 } | 1339 } |
| 1342 | 1340 |
| 1343 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, | 1341 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1344 BrowserCloseManagerWithBackgroundModeBrowserTest, | 1342 BrowserCloseManagerWithBackgroundModeBrowserTest, |
| 1345 testing::Bool()); | 1343 testing::Bool()); |
| OLD | NEW |