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

Side by Side Diff: content/browser/android/url_request_content_job_unittest.cc

Issue 2800893002: Use ScopedTaskEnvironment instead of MessageLoop in content unit tests. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | content/browser/appcache/appcache_quota_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/android/url_request_content_job.h" 5 #include "content/browser/android/url_request_content_job.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/test/scoped_task_environment.h"
15 #include "base/test/test_file_util.h" 16 #include "base/test/test_file_util.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "net/url_request/url_request.h" 18 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_test_util.h" 19 #include "net/url_request/url_request_test_util.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 namespace content { 22 namespace content {
22 23
23 namespace { 24 namespace {
24 25
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 URLRequestContentJobTest(); 110 URLRequestContentJobTest();
110 111
111 protected: 112 protected:
112 // This inserts an image file into the android MediaStore and retrieves the 113 // This inserts an image file into the android MediaStore and retrieves the
113 // content URI. Then creates and runs a URLRequestContentJob to get the 114 // content URI. Then creates and runs a URLRequestContentJob to get the
114 // contents out of it. If a Range is provided, this function will add the 115 // contents out of it. If a Range is provided, this function will add the
115 // appropriate Range http header to the request and verify the bytes 116 // appropriate Range http header to the request and verify the bytes
116 // retrieved. 117 // retrieved.
117 void RunRequest(const Range* range); 118 void RunRequest(const Range* range);
118 119
119 base::MessageLoop message_loop_; 120 base::test::ScopedTaskEnvironment scoped_task_environment_;
120 JobObserverImpl observer_; 121 JobObserverImpl observer_;
121 net::TestURLRequestContext context_; 122 net::TestURLRequestContext context_;
122 net::TestDelegate delegate_; 123 net::TestDelegate delegate_;
123 }; 124 };
124 125
125 URLRequestContentJobTest::URLRequestContentJobTest() {} 126 URLRequestContentJobTest::URLRequestContentJobTest() {}
126 127
127 void URLRequestContentJobTest::RunRequest(const Range* range) { 128 void URLRequestContentJobTest::RunRequest(const Range* range) {
128 base::FilePath test_dir; 129 base::FilePath test_dir;
129 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir); 130 PathService::Get(base::DIR_SOURCE_ROOT, &test_dir);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 } 189 }
189 190
190 TEST_F(URLRequestContentJobTest, ContentURIWithZeroRange) { 191 TEST_F(URLRequestContentJobTest, ContentURIWithZeroRange) {
191 Range range(0, 0); 192 Range range(0, 0);
192 RunRequest(&range); 193 RunRequest(&range);
193 } 194 }
194 195
195 } // namespace 196 } // namespace
196 197
197 } // namespace content 198 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache_quota_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698