Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/string_number_conversions.h" 6 #include "base/string_number_conversions.h"
7 #include "chrome/browser/download/download_service.h"
8 #include "chrome/browser/download/download_service_factory.h"
7 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
8 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
11 #include "chrome/browser/ui/browser_window.h" 13 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/find_bar/find_bar.h" 14 #include "chrome/browser/ui/find_bar/find_bar.h"
13 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 15 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
14 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 16 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
15 #include "chrome/browser/ui/panels/native_panel.h" 17 #include "chrome/browser/ui/panels/native_panel.h"
16 #include "chrome/browser/ui/panels/panel.h" 18 #include "chrome/browser/ui/panels/panel.h"
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 } 1165 }
1164 1166
1165 private: 1167 private:
1166 // Location of the downloads directory for download tests. 1168 // Location of the downloads directory for download tests.
1167 ScopedTempDir downloads_directory_; 1169 ScopedTempDir downloads_directory_;
1168 }; 1170 };
1169 1171
1170 class DownloadObserver : public DownloadManager::Observer { 1172 class DownloadObserver : public DownloadManager::Observer {
1171 public: 1173 public:
1172 explicit DownloadObserver(Profile* profile) 1174 explicit DownloadObserver(Profile* profile)
1173 : download_manager_(profile->GetDownloadManager()), 1175 : download_manager_(
1176 DownloadServiceFactory::GetForProfile(profile)->GetDownloadManager()),
1174 saw_download_(false), 1177 saw_download_(false),
1175 waiting_(false) { 1178 waiting_(false) {
1176 download_manager_->AddObserver(this); 1179 download_manager_->AddObserver(this);
1177 } 1180 }
1178 1181
1179 ~DownloadObserver() { 1182 ~DownloadObserver() {
1180 download_manager_->RemoveObserver(this); 1183 download_manager_->RemoveObserver(this);
1181 } 1184 }
1182 1185
1183 void WaitForDownload() { 1186 void WaitForDownload() {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 EXPECT_EQ(1, tabbed_browser->tab_count()); 1306 EXPECT_EQ(1, tabbed_browser->tab_count());
1304 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible()); 1307 ASSERT_TRUE(tabbed_browser->window()->IsDownloadShelfVisible());
1305 tabbed_browser->CloseWindow(); 1308 tabbed_browser->CloseWindow();
1306 #endif 1309 #endif
1307 1310
1308 EXPECT_EQ(1, panel_browser->tab_count()); 1311 EXPECT_EQ(1, panel_browser->tab_count());
1309 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible()); 1312 ASSERT_FALSE(panel_browser->window()->IsDownloadShelfVisible());
1310 1313
1311 panel_browser->CloseWindow(); 1314 panel_browser->CloseWindow();
1312 } 1315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698