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

Side by Side Diff: chrome/browser/download/notification/download_notification_browsertest.cc

Issue 2853363002: Rename the DownloadService to DownloadCoreService (Closed)
Patch Set: Created 3 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" 14 #include "chrome/browser/chromeos/profiles/profile_helper.h"
15 #include "chrome/browser/download/chrome_download_manager_delegate.h" 15 #include "chrome/browser/download/chrome_download_manager_delegate.h"
16 #include "chrome/browser/download/download_core_service.h"
17 #include "chrome/browser/download/download_core_service_factory.h"
16 #include "chrome/browser/download/download_prefs.h" 18 #include "chrome/browser/download/download_prefs.h"
17 #include "chrome/browser/download/download_service.h"
18 #include "chrome/browser/download/download_service_factory.h"
19 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
23 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
24 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "chrome/grit/chromium_strings.h" 26 #include "chrome/grit/chromium_strings.h"
27 #include "chrome/grit/generated_resources.h" 27 #include "chrome/grit/generated_resources.h"
28 #include "chrome/grit/theme_resources.h" 28 #include "chrome/grit/theme_resources.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 public: 324 public:
325 ~DownloadNotificationTest() override {} 325 ~DownloadNotificationTest() override {}
326 326
327 void SetUpOnMainThread() override { 327 void SetUpOnMainThread() override {
328 Profile* profile = browser()->profile(); 328 Profile* profile = browser()->profile();
329 329
330 std::unique_ptr<TestChromeDownloadManagerDelegate> test_delegate; 330 std::unique_ptr<TestChromeDownloadManagerDelegate> test_delegate;
331 test_delegate.reset(new TestChromeDownloadManagerDelegate(profile)); 331 test_delegate.reset(new TestChromeDownloadManagerDelegate(profile));
332 test_delegate->GetDownloadIdReceiverCallback().Run( 332 test_delegate->GetDownloadIdReceiverCallback().Run(
333 content::DownloadItem::kInvalidId + 1); 333 content::DownloadItem::kInvalidId + 1);
334 DownloadServiceFactory::GetForBrowserContext(profile) 334 DownloadCoreServiceFactory::GetForBrowserContext(profile)
335 ->SetDownloadManagerDelegateForTesting(std::move(test_delegate)); 335 ->SetDownloadManagerDelegateForTesting(std::move(test_delegate));
336 336
337 DownloadNotificationTestBase::SetUpOnMainThread(); 337 DownloadNotificationTestBase::SetUpOnMainThread();
338 } 338 }
339 339
340 TestChromeDownloadManagerDelegate* GetDownloadManagerDelegate() const { 340 TestChromeDownloadManagerDelegate* GetDownloadManagerDelegate() const {
341 return static_cast<TestChromeDownloadManagerDelegate*>( 341 return static_cast<TestChromeDownloadManagerDelegate*>(
342 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) 342 DownloadCoreServiceFactory::GetForBrowserContext(browser()->profile())
343 ->GetDownloadManagerDelegate()); 343 ->GetDownloadManagerDelegate());
344 } 344 }
345 345
346 void PrepareIncognitoBrowser() { 346 void PrepareIncognitoBrowser() {
347 incognito_browser_ = CreateIncognitoBrowser(); 347 incognito_browser_ = CreateIncognitoBrowser();
348 Profile* incognito_profile = incognito_browser_->profile(); 348 Profile* incognito_profile = incognito_browser_->profile();
349 349
350 ASSERT_TRUE(SetDownloadsDirectory(incognito_browser_)); 350 ASSERT_TRUE(SetDownloadsDirectory(incognito_browser_));
351 351
352 std::unique_ptr<TestChromeDownloadManagerDelegate> incognito_test_delegate; 352 std::unique_ptr<TestChromeDownloadManagerDelegate> incognito_test_delegate;
353 incognito_test_delegate.reset( 353 incognito_test_delegate.reset(
354 new TestChromeDownloadManagerDelegate(incognito_profile)); 354 new TestChromeDownloadManagerDelegate(incognito_profile));
355 DownloadServiceFactory::GetForBrowserContext(incognito_profile) 355 DownloadCoreServiceFactory::GetForBrowserContext(incognito_profile)
356 ->SetDownloadManagerDelegateForTesting( 356 ->SetDownloadManagerDelegateForTesting(
357 std::move(incognito_test_delegate)); 357 std::move(incognito_test_delegate));
358 } 358 }
359 359
360 TestChromeDownloadManagerDelegate* GetIncognitoDownloadManagerDelegate() 360 TestChromeDownloadManagerDelegate* GetIncognitoDownloadManagerDelegate()
361 const { 361 const {
362 Profile* incognito_profile = incognito_browser()->profile(); 362 Profile* incognito_profile = incognito_browser()->profile();
363 return static_cast<TestChromeDownloadManagerDelegate*>( 363 return static_cast<TestChromeDownloadManagerDelegate*>(
364 DownloadServiceFactory::GetForBrowserContext(incognito_profile)-> 364 DownloadCoreServiceFactory::GetForBrowserContext(incognito_profile)
365 GetDownloadManagerDelegate()); 365 ->GetDownloadManagerDelegate());
366 } 366 }
367 367
368 void CreateDownload() { 368 void CreateDownload() {
369 return CreateDownloadForBrowserAndURL( 369 return CreateDownloadForBrowserAndURL(
370 browser(), 370 browser(),
371 GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl)); 371 GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl));
372 } 372 }
373 373
374 void CreateDownloadForBrowserAndURL(Browser* browser, GURL url) { 374 void CreateDownloadForBrowserAndURL(Browser* browser, GURL url) {
375 // Starts a download. 375 // Starts a download.
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1299 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1300 GetNotification(notification_id_user1)->type()); 1300 GetNotification(notification_id_user1)->type());
1301 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1301 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1302 GetNotification(notification_id_user2_1)->type()); 1302 GetNotification(notification_id_user2_1)->type());
1303 // Normal notifications for user2. 1303 // Normal notifications for user2.
1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1305 GetNotification(notification_id_user2_1)->type()); 1305 GetNotification(notification_id_user2_1)->type());
1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, 1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT,
1307 GetNotification(notification_id_user2_2)->type()); 1307 GetNotification(notification_id_user2_2)->type());
1308 } 1308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698