| 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 "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/download/download_danger_prompt.h" | 9 #include "chrome/browser/download/download_danger_prompt.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 SafeBrowsingService::RegisterFactory(nullptr); | 58 SafeBrowsingService::RegisterFactory(nullptr); |
| 59 InProcessBrowserTest::TearDown(); | 59 InProcessBrowserTest::TearDown(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Opens a new tab and waits for navigations to finish. If there are pending | 62 // Opens a new tab and waits for navigations to finish. If there are pending |
| 63 // navigations, the constrained prompt might be dismissed when the navigation | 63 // navigations, the constrained prompt might be dismissed when the navigation |
| 64 // completes. | 64 // completes. |
| 65 void OpenNewTab() { | 65 void OpenNewTab() { |
| 66 ui_test_utils::NavigateToURLWithDisposition( | 66 ui_test_utils::NavigateToURLWithDisposition( |
| 67 browser(), GURL("about:blank"), | 67 browser(), GURL("about:blank"), |
| 68 NEW_FOREGROUND_TAB, | 68 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 69 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | | 69 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 70 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 70 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SetUpExpectations( | 73 void SetUpExpectations( |
| 74 const DownloadDangerPrompt::Action& expected_action, | 74 const DownloadDangerPrompt::Action& expected_action, |
| 75 const content::DownloadDangerType& danger_type, | 75 const content::DownloadDangerType& danger_type, |
| 76 const ClientDownloadResponse::Verdict& download_verdict, | 76 const ClientDownloadResponse::Verdict& download_verdict, |
| 77 const std::string& token, | 77 const std::string& token, |
| 78 bool from_download_api) { | 78 bool from_download_api) { |
| 79 did_receive_callback_ = false; | 79 did_receive_callback_ = false; |
| 80 expected_action_ = expected_action; | 80 expected_action_ = expected_action; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT, | 296 content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT, |
| 297 ClientDownloadResponse::UNCOMMON, | 297 ClientDownloadResponse::UNCOMMON, |
| 298 std::string(), | 298 std::string(), |
| 299 true); | 299 true); |
| 300 EXPECT_CALL(download(), IsDangerous()).WillRepeatedly(Return(true)); | 300 EXPECT_CALL(download(), IsDangerous()).WillRepeatedly(Return(true)); |
| 301 SimulatePromptAction(DownloadDangerPrompt::CANCEL); | 301 SimulatePromptAction(DownloadDangerPrompt::CANCEL); |
| 302 VerifyExpectations(true); | 302 VerifyExpectations(true); |
| 303 } | 303 } |
| 304 | 304 |
| 305 } // namespace safe_browsing | 305 } // namespace safe_browsing |
| OLD | NEW |