OLD | NEW |
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 | 7 |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 15 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
15 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 16 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 ~DownloadNotificationTest() override {} | 332 ~DownloadNotificationTest() override {} |
332 | 333 |
333 void SetUpOnMainThread() override { | 334 void SetUpOnMainThread() override { |
334 Profile* profile = browser()->profile(); | 335 Profile* profile = browser()->profile(); |
335 | 336 |
336 scoped_ptr<TestChromeDownloadManagerDelegate> test_delegate; | 337 scoped_ptr<TestChromeDownloadManagerDelegate> test_delegate; |
337 test_delegate.reset(new TestChromeDownloadManagerDelegate(profile)); | 338 test_delegate.reset(new TestChromeDownloadManagerDelegate(profile)); |
338 test_delegate->GetDownloadIdReceiverCallback().Run( | 339 test_delegate->GetDownloadIdReceiverCallback().Run( |
339 content::DownloadItem::kInvalidId + 1); | 340 content::DownloadItem::kInvalidId + 1); |
340 DownloadServiceFactory::GetForBrowserContext(profile) | 341 DownloadServiceFactory::GetForBrowserContext(profile) |
341 ->SetDownloadManagerDelegateForTesting(test_delegate.Pass()); | 342 ->SetDownloadManagerDelegateForTesting(std::move(test_delegate)); |
342 | 343 |
343 DownloadNotificationTestBase::SetUpOnMainThread(); | 344 DownloadNotificationTestBase::SetUpOnMainThread(); |
344 } | 345 } |
345 | 346 |
346 TestChromeDownloadManagerDelegate* GetDownloadManagerDelegate() const { | 347 TestChromeDownloadManagerDelegate* GetDownloadManagerDelegate() const { |
347 return static_cast<TestChromeDownloadManagerDelegate*>( | 348 return static_cast<TestChromeDownloadManagerDelegate*>( |
348 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) | 349 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) |
349 ->GetDownloadManagerDelegate()); | 350 ->GetDownloadManagerDelegate()); |
350 } | 351 } |
351 | 352 |
352 void PrepareIncognitoBrowser() { | 353 void PrepareIncognitoBrowser() { |
353 incognito_browser_ = CreateIncognitoBrowser(); | 354 incognito_browser_ = CreateIncognitoBrowser(); |
354 Profile* incognito_profile = incognito_browser_->profile(); | 355 Profile* incognito_profile = incognito_browser_->profile(); |
355 | 356 |
356 ASSERT_TRUE(CreateAndSetDownloadsDirectory(incognito_browser_)); | 357 ASSERT_TRUE(CreateAndSetDownloadsDirectory(incognito_browser_)); |
357 | 358 |
358 scoped_ptr<TestChromeDownloadManagerDelegate> incognito_test_delegate; | 359 scoped_ptr<TestChromeDownloadManagerDelegate> incognito_test_delegate; |
359 incognito_test_delegate.reset( | 360 incognito_test_delegate.reset( |
360 new TestChromeDownloadManagerDelegate(incognito_profile)); | 361 new TestChromeDownloadManagerDelegate(incognito_profile)); |
361 DownloadServiceFactory::GetForBrowserContext(incognito_profile) | 362 DownloadServiceFactory::GetForBrowserContext(incognito_profile) |
362 ->SetDownloadManagerDelegateForTesting(incognito_test_delegate.Pass()); | 363 ->SetDownloadManagerDelegateForTesting( |
| 364 std::move(incognito_test_delegate)); |
363 } | 365 } |
364 | 366 |
365 TestChromeDownloadManagerDelegate* GetIncognitoDownloadManagerDelegate() | 367 TestChromeDownloadManagerDelegate* GetIncognitoDownloadManagerDelegate() |
366 const { | 368 const { |
367 Profile* incognito_profile = incognito_browser()->profile(); | 369 Profile* incognito_profile = incognito_browser()->profile(); |
368 return static_cast<TestChromeDownloadManagerDelegate*>( | 370 return static_cast<TestChromeDownloadManagerDelegate*>( |
369 DownloadServiceFactory::GetForBrowserContext(incognito_profile)-> | 371 DownloadServiceFactory::GetForBrowserContext(incognito_profile)-> |
370 GetDownloadManagerDelegate()); | 372 GetDownloadManagerDelegate()); |
371 } | 373 } |
372 | 374 |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
1305 GetNotification(notification_id_user1)->type()); | 1307 GetNotification(notification_id_user1)->type()); |
1306 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1308 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
1307 GetNotification(notification_id_user2_1)->type()); | 1309 GetNotification(notification_id_user2_1)->type()); |
1308 // Normal notifications for user2. | 1310 // Normal notifications for user2. |
1309 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1311 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
1310 GetNotification(notification_id_user2_1)->type()); | 1312 GetNotification(notification_id_user2_1)->type()); |
1311 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, | 1313 EXPECT_EQ(message_center::NOTIFICATION_TYPE_BASE_FORMAT, |
1312 GetNotification(notification_id_user2_2)->type()); | 1314 GetNotification(notification_id_user2_2)->type()); |
1313 } | 1315 } |
OLD | NEW |