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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 content::MockDownloadItem download_; | 96 content::MockDownloadItem download_; |
97 DownloadDangerPrompt* prompt_; | 97 DownloadDangerPrompt* prompt_; |
98 DownloadDangerPrompt::Action expected_action_; | 98 DownloadDangerPrompt::Action expected_action_; |
99 bool did_receive_callback_; | 99 bool did_receive_callback_; |
100 | 100 |
101 DISALLOW_COPY_AND_ASSIGN(DownloadDangerPromptTest); | 101 DISALLOW_COPY_AND_ASSIGN(DownloadDangerPromptTest); |
102 }; | 102 }; |
103 | 103 |
104 IN_PROC_BROWSER_TEST_F(DownloadDangerPromptTest, TestAll) { | 104 // Disabled for flaky timeouts on Windows. crbug.com/446696 |
| 105 #if defined(OS_WIN) |
| 106 #define MAYBE_TestAll DISABLED_TestAll |
| 107 #else |
| 108 #define MAYBE_TestAll TestAll |
| 109 #endif |
| 110 IN_PROC_BROWSER_TEST_F(DownloadDangerPromptTest, MAYBE_TestAll) { |
105 // ExperienceSampling: Set default actions for DownloadItem methods we need. | 111 // ExperienceSampling: Set default actions for DownloadItem methods we need. |
106 ON_CALL(download(), GetURL()).WillByDefault(ReturnRef(GURL::EmptyGURL())); | 112 ON_CALL(download(), GetURL()).WillByDefault(ReturnRef(GURL::EmptyGURL())); |
107 ON_CALL(download(), GetReferrerUrl()) | 113 ON_CALL(download(), GetReferrerUrl()) |
108 .WillByDefault(ReturnRef(GURL::EmptyGURL())); | 114 .WillByDefault(ReturnRef(GURL::EmptyGURL())); |
109 ON_CALL(download(), GetBrowserContext()) | 115 ON_CALL(download(), GetBrowserContext()) |
110 .WillByDefault(Return(browser()->profile())); | 116 .WillByDefault(Return(browser()->profile())); |
111 | 117 |
112 OpenNewTab(); | 118 OpenNewTab(); |
113 | 119 |
114 // Clicking the Accept button should invoke the ACCEPT action. | 120 // Clicking the Accept button should invoke the ACCEPT action. |
(...skipping 29 matching lines...) Expand all Loading... |
144 download().NotifyObserversDownloadUpdated(); | 150 download().NotifyObserversDownloadUpdated(); |
145 SimulatePromptAction(DownloadDangerPrompt::ACCEPT); | 151 SimulatePromptAction(DownloadDangerPrompt::ACCEPT); |
146 VerifyExpectations(); | 152 VerifyExpectations(); |
147 | 153 |
148 // If the containing tab is closed, the dialog should DISMISS itself. | 154 // If the containing tab is closed, the dialog should DISMISS itself. |
149 OpenNewTab(); | 155 OpenNewTab(); |
150 SetUpExpectations(DownloadDangerPrompt::DISMISS); | 156 SetUpExpectations(DownloadDangerPrompt::DISMISS); |
151 chrome::CloseTab(browser()); | 157 chrome::CloseTab(browser()); |
152 VerifyExpectations(); | 158 VerifyExpectations(); |
153 } | 159 } |
OLD | NEW |