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

Side by Side Diff: chrome/browser/android/download/download_manager_service_unittest.cc

Issue 2315443004: Remove calls to deprecated MessageLoop methods in chrome. (Closed)
Patch Set: remove unused include Created 4 years, 3 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 "chrome/browser/android/download/download_manager_service.h" 5 #include "chrome/browser/android/download/download_manager_service.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
12 #include "content/public/browser/download_item.h" 13 #include "content/public/browser/download_item.h"
13 #include "content/public/browser/download_manager.h" 14 #include "content/public/browser/download_manager.h"
14 #include "content/public/browser/download_url_parameters.h" 15 #include "content/public/browser/download_url_parameters.h"
15 #include "content/public/test/mock_download_item.h" 16 #include "content/public/test/mock_download_item.h"
16 #include "content/public/test/mock_download_manager.h" 17 #include "content/public/test/mock_download_manager.h"
17 #include "testing/gmock/include/gmock/gmock.h" 18 #include "testing/gmock/include/gmock/gmock.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "url/origin.h" 20 #include "url/origin.h"
20 21
21 using ::testing::_; 22 using ::testing::_;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 &DownloadManagerServiceTest::OnResumptionDone, base::Unretained(this))); 76 &DownloadManagerServiceTest::OnResumptionDone, base::Unretained(this)));
76 service_->ResumeDownload( 77 service_->ResumeDownload(
77 env, nullptr, 78 env, nullptr,
78 JavaParamRef<jstring>( 79 JavaParamRef<jstring>(
79 env, 80 env,
80 base::android::ConvertUTF8ToJavaString(env, download_guid).obj()), 81 base::android::ConvertUTF8ToJavaString(env, download_guid).obj()),
81 false); 82 false);
82 EXPECT_FALSE(success_); 83 EXPECT_FALSE(success_);
83 service_->OnHistoryQueryComplete(); 84 service_->OnHistoryQueryComplete();
84 while (!finished_) 85 while (!finished_)
85 message_loop_.RunUntilIdle(); 86 base::RunLoop().RunUntilIdle();
86 } 87 }
87 88
88 protected: 89 protected:
89 base::MessageLoop message_loop_; 90 base::MessageLoop message_loop_;
90 MockDownloadManagerService* service_; 91 MockDownloadManagerService* service_;
91 bool finished_; 92 bool finished_;
92 bool success_; 93 bool success_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(DownloadManagerServiceTest); 95 DISALLOW_COPY_AND_ASSIGN(DownloadManagerServiceTest);
95 }; 96 };
96 97
97 // Test that resumption succeeds if the download item is found and can be 98 // Test that resumption succeeds if the download item is found and can be
98 // resumed. 99 // resumed.
99 TEST_F(DownloadManagerServiceTest, ResumptionWithResumableItem) { 100 TEST_F(DownloadManagerServiceTest, ResumptionWithResumableItem) {
100 service_->CreateDownloadItem(true); 101 service_->CreateDownloadItem(true);
101 StartDownload("0000"); 102 StartDownload("0000");
102 EXPECT_TRUE(success_); 103 EXPECT_TRUE(success_);
103 } 104 }
104 105
105 // Test that resumption fails if the target download item is not resumable. 106 // Test that resumption fails if the target download item is not resumable.
106 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) { 107 TEST_F(DownloadManagerServiceTest, ResumptionWithNonResumableItem) {
107 service_->CreateDownloadItem(false); 108 service_->CreateDownloadItem(false);
108 StartDownload("0000"); 109 StartDownload("0000");
109 EXPECT_FALSE(success_); 110 EXPECT_FALSE(success_);
110 } 111 }
OLDNEW
« no previous file with comments | « chrome/app_shim/chrome_main_app_mode_mac.mm ('k') | chrome/browser/autocomplete/shortcuts_provider_extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698