| 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" | 5 #include "base/bind.h" |
| 6 #include "chrome/browser/download/download_service.h" |
| 7 #include "chrome/browser/download/download_service_factory.h" |
| 6 #include "chrome/browser/net/url_request_mock_util.h" | 8 #include "chrome/browser/net/url_request_mock_util.h" |
| 7 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/browser_list.h" | 11 #include "chrome/browser/ui/browser_list.h" |
| 10 #include "chrome/browser/ui/browser_window.h" | 12 #include "chrome/browser/ui/browser_window.h" |
| 11 #include "chrome/browser/ui/find_bar/find_bar.h" | 13 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 12 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 14 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 13 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 15 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 14 #include "chrome/browser/ui/panels/native_panel.h" | 16 #include "chrome/browser/ui/panels/native_panel.h" |
| 15 #include "chrome/browser/ui/panels/panel.h" | 17 #include "chrome/browser/ui/panels/panel.h" |
| (...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 } | 937 } |
| 936 | 938 |
| 937 private: | 939 private: |
| 938 // Location of the downloads directory for download tests. | 940 // Location of the downloads directory for download tests. |
| 939 ScopedTempDir downloads_directory_; | 941 ScopedTempDir downloads_directory_; |
| 940 }; | 942 }; |
| 941 | 943 |
| 942 class DownloadObserver : public DownloadManager::Observer { | 944 class DownloadObserver : public DownloadManager::Observer { |
| 943 public: | 945 public: |
| 944 explicit DownloadObserver(Profile* profile) | 946 explicit DownloadObserver(Profile* profile) |
| 945 : download_manager_(profile->GetDownloadManager()), | 947 : download_manager_( |
| 948 DownloadServiceFactory::GetForProfile(profile)->GetDownloadManager()), |
| 946 saw_download_(false), | 949 saw_download_(false), |
| 947 waiting_(false) { | 950 waiting_(false) { |
| 948 download_manager_->AddObserver(this); | 951 download_manager_->AddObserver(this); |
| 949 } | 952 } |
| 950 | 953 |
| 951 ~DownloadObserver() { | 954 ~DownloadObserver() { |
| 952 download_manager_->RemoveObserver(this); | 955 download_manager_->RemoveObserver(this); |
| 953 } | 956 } |
| 954 | 957 |
| 955 void WaitForDownload() { | 958 void WaitForDownload() { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 EXPECT_EQ(1, tabbed_browser->tab_count()); | 1078 EXPECT_EQ(1, tabbed_browser->tab_count()); |
| 1076 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); | 1079 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); |
| 1077 tabbed_browser->CloseWindow(); | 1080 tabbed_browser->CloseWindow(); |
| 1078 #endif | 1081 #endif |
| 1079 | 1082 |
| 1080 EXPECT_EQ(1, panel_browser->tab_count()); | 1083 EXPECT_EQ(1, panel_browser->tab_count()); |
| 1081 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); | 1084 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); |
| 1082 | 1085 |
| 1083 panel_browser->CloseWindow(); | 1086 panel_browser->CloseWindow(); |
| 1084 } | 1087 } |
| OLD | NEW |