| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "chrome/browser/download/download_danger_prompt.h" | 7 #include "chrome/browser/download/download_danger_prompt.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_commands.h" | 10 #include "chrome/browser/ui/browser_commands.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 using ::testing::SaveArg; | 25 using ::testing::SaveArg; |
| 26 | 26 |
| 27 class DownloadDangerPromptTest : public InProcessBrowserTest { | 27 class DownloadDangerPromptTest : public InProcessBrowserTest { |
| 28 public: | 28 public: |
| 29 DownloadDangerPromptTest() | 29 DownloadDangerPromptTest() |
| 30 : prompt_(NULL), | 30 : prompt_(NULL), |
| 31 expected_action_(DownloadDangerPrompt::CANCEL), | 31 expected_action_(DownloadDangerPrompt::CANCEL), |
| 32 did_receive_callback_(false) { | 32 did_receive_callback_(false) { |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual ~DownloadDangerPromptTest() { | 35 ~DownloadDangerPromptTest() override {} |
| 36 } | |
| 37 | 36 |
| 38 // Opens a new tab and waits for navigations to finish. If there are pending | 37 // Opens a new tab and waits for navigations to finish. If there are pending |
| 39 // navigations, the constrained prompt might be dismissed when the navigation | 38 // navigations, the constrained prompt might be dismissed when the navigation |
| 40 // completes. | 39 // completes. |
| 41 void OpenNewTab() { | 40 void OpenNewTab() { |
| 42 ui_test_utils::NavigateToURLWithDisposition( | 41 ui_test_utils::NavigateToURLWithDisposition( |
| 43 browser(), GURL("about:blank"), | 42 browser(), GURL("about:blank"), |
| 44 NEW_FOREGROUND_TAB, | 43 NEW_FOREGROUND_TAB, |
| 45 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | | 44 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 46 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 45 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 download().NotifyObserversDownloadUpdated(); | 144 download().NotifyObserversDownloadUpdated(); |
| 146 SimulatePromptAction(DownloadDangerPrompt::ACCEPT); | 145 SimulatePromptAction(DownloadDangerPrompt::ACCEPT); |
| 147 VerifyExpectations(); | 146 VerifyExpectations(); |
| 148 | 147 |
| 149 // If the containing tab is closed, the dialog should DISMISS itself. | 148 // If the containing tab is closed, the dialog should DISMISS itself. |
| 150 OpenNewTab(); | 149 OpenNewTab(); |
| 151 SetUpExpectations(DownloadDangerPrompt::DISMISS); | 150 SetUpExpectations(DownloadDangerPrompt::DISMISS); |
| 152 chrome::CloseTab(browser()); | 151 chrome::CloseTab(browser()); |
| 153 VerifyExpectations(); | 152 VerifyExpectations(); |
| 154 } | 153 } |
| OLD | NEW |