| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 6 #include "chrome/browser/net/url_request_mock_util.h" |
| 5 #include "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/prefs/pref_service.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| 9 #include "chrome/browser/ui/find_bar/find_bar.h" | 11 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 10 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 12 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 11 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 13 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 12 #include "chrome/browser/ui/panels/native_panel.h" | 14 #include "chrome/browser/ui/panels/native_panel.h" |
| 13 #include "chrome/browser/ui/panels/panel.h" | 15 #include "chrome/browser/ui/panels/panel.h" |
| 14 #include "chrome/browser/ui/panels/panel_manager.h" | 16 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 bool CreateDownloadDirectory(Profile* profile) { | 850 bool CreateDownloadDirectory(Profile* profile) { |
| 849 bool created = downloads_directory_.CreateUniqueTempDir(); | 851 bool created = downloads_directory_.CreateUniqueTempDir(); |
| 850 if (!created) | 852 if (!created) |
| 851 return false; | 853 return false; |
| 852 profile->GetPrefs()->SetFilePath( | 854 profile->GetPrefs()->SetFilePath( |
| 853 prefs::kDownloadDefaultDirectory, | 855 prefs::kDownloadDefaultDirectory, |
| 854 downloads_directory_.path()); | 856 downloads_directory_.path()); |
| 855 return true; | 857 return true; |
| 856 } | 858 } |
| 857 | 859 |
| 860 protected: |
| 861 void SetUpOnMainThread() OVERRIDE { |
| 862 PanelBrowserTest::SetUpOnMainThread(); |
| 863 |
| 864 BrowserThread::PostTask( |
| 865 BrowserThread::IO, FROM_HERE, |
| 866 base::Bind(&chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 867 } |
| 868 |
| 858 private: | 869 private: |
| 859 // Location of the downloads directory for download tests. | 870 // Location of the downloads directory for download tests. |
| 860 ScopedTempDir downloads_directory_; | 871 ScopedTempDir downloads_directory_; |
| 861 }; | 872 }; |
| 862 | 873 |
| 863 class DownloadObserver : public DownloadManager::Observer { | 874 class DownloadObserver : public DownloadManager::Observer { |
| 864 public: | 875 public: |
| 865 explicit DownloadObserver(Profile* profile) | 876 explicit DownloadObserver(Profile* profile) |
| 866 : download_manager_(profile->GetDownloadManager()), | 877 : download_manager_(profile->GetDownloadManager()), |
| 867 saw_download_(false), | 878 saw_download_(false), |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 EXPECT_EQ(1, tabbed_browser->tab_count()); | 1007 EXPECT_EQ(1, tabbed_browser->tab_count()); |
| 997 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); | 1008 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); |
| 998 tabbed_browser->CloseWindow(); | 1009 tabbed_browser->CloseWindow(); |
| 999 #endif | 1010 #endif |
| 1000 | 1011 |
| 1001 EXPECT_EQ(1, panel_browser->tab_count()); | 1012 EXPECT_EQ(1, panel_browser->tab_count()); |
| 1002 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); | 1013 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); |
| 1003 | 1014 |
| 1004 panel_browser->CloseWindow(); | 1015 panel_browser->CloseWindow(); |
| 1005 } | 1016 } |
| OLD | NEW |