| 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 // Disable everything on windows only. http://crbug.com/306144 | 5 // Disable everything on windows only. http://crbug.com/306144 |
| 6 #ifndef OS_WIN | 6 #ifndef OS_WIN |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 void SetUpOnMainThread() override { | 313 void SetUpOnMainThread() override { |
| 314 ExtensionApiTest::SetUpOnMainThread(); | 314 ExtensionApiTest::SetUpOnMainThread(); |
| 315 BrowserThread::PostTask( | 315 BrowserThread::PostTask( |
| 316 BrowserThread::IO, FROM_HERE, | 316 BrowserThread::IO, FROM_HERE, |
| 317 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 317 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 318 InProcessBrowserTest::SetUpOnMainThread(); | 318 InProcessBrowserTest::SetUpOnMainThread(); |
| 319 GoOnTheRecord(); | 319 GoOnTheRecord(); |
| 320 CreateAndSetDownloadsDirectory(); | 320 CreateAndSetDownloadsDirectory(); |
| 321 current_browser()->profile()->GetPrefs()->SetBoolean( | 321 current_browser()->profile()->GetPrefs()->SetBoolean( |
| 322 prefs::kPromptForDownload, false); | 322 prefs::kPromptForDownload, false); |
| 323 GetOnRecordManager()->RemoveAllDownloads(); | |
| 324 events_listener_.reset(new DownloadsEventsListener()); | 323 events_listener_.reset(new DownloadsEventsListener()); |
| 325 // Disable file chooser for current profile. | 324 // Disable file chooser for current profile. |
| 326 DownloadTestFileActivityObserver observer(current_browser()->profile()); | 325 DownloadTestFileActivityObserver observer(current_browser()->profile()); |
| 327 observer.EnableFileChooser(false); | 326 observer.EnableFileChooser(false); |
| 328 } | 327 } |
| 329 | 328 |
| 330 void GoOnTheRecord() { current_browser_ = browser(); } | 329 void GoOnTheRecord() { current_browser_ = browser(); } |
| 331 | 330 |
| 332 void GoOffTheRecord() { | 331 void GoOffTheRecord() { |
| 333 if (!incognito_browser_) { | 332 if (!incognito_browser_) { |
| 334 incognito_browser_ = CreateIncognitoBrowser(); | 333 incognito_browser_ = CreateIncognitoBrowser(); |
| 335 GetOffRecordManager()->RemoveAllDownloads(); | |
| 336 // Disable file chooser for incognito profile. | 334 // Disable file chooser for incognito profile. |
| 337 DownloadTestFileActivityObserver observer(incognito_browser_->profile()); | 335 DownloadTestFileActivityObserver observer(incognito_browser_->profile()); |
| 338 observer.EnableFileChooser(false); | 336 observer.EnableFileChooser(false); |
| 339 } | 337 } |
| 340 current_browser_ = incognito_browser_; | 338 current_browser_ = incognito_browser_; |
| 341 } | 339 } |
| 342 | 340 |
| 343 bool WaitFor(const std::string& event_name, const std::string& json_args) { | 341 bool WaitFor(const std::string& event_name, const std::string& json_args) { |
| 344 return events_listener_->WaitFor( | 342 return events_listener_->WaitFor( |
| 345 current_browser()->profile(), event_name, json_args); | 343 current_browser()->profile(), event_name, json_args); |
| (...skipping 3957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4303 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4301 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
| 4304 EXPECT_FALSE(warnings.empty()); | 4302 EXPECT_FALSE(warnings.empty()); |
| 4305 EXPECT_EQ(Warning::kDownloadFilenameConflict, | 4303 EXPECT_EQ(Warning::kDownloadFilenameConflict, |
| 4306 warnings.begin()->warning_type()); | 4304 warnings.begin()->warning_type()); |
| 4307 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4305 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
| 4308 } | 4306 } |
| 4309 | 4307 |
| 4310 } // namespace extensions | 4308 } // namespace extensions |
| 4311 | 4309 |
| 4312 #endif // http://crbug.com/306144 | 4310 #endif // http://crbug.com/306144 |
| OLD | NEW |