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

Side by Side Diff: storage/browser/fileapi/file_system_dir_url_request_job_unittest.cc

Issue 2845073002: Test network traffic annotation tag added to fileapi unittests. (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
« no previous file with comments | « no previous file | storage/browser/fileapi/file_system_url_request_job_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdint.h> 5 #include <stdint.h>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/string_piece.h" 18 #include "base/strings/string_piece.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
23 #include "net/base/request_priority.h" 23 #include "net/base/request_priority.h"
24 #include "net/http/http_request_headers.h" 24 #include "net/http/http_request_headers.h"
25 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
25 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
26 #include "net/url_request/url_request_context.h" 27 #include "net/url_request/url_request_context.h"
27 #include "net/url_request/url_request_test_util.h" 28 #include "net/url_request/url_request_test_util.h"
28 #include "storage/browser/fileapi/external_mount_points.h" 29 #include "storage/browser/fileapi/external_mount_points.h"
29 #include "storage/browser/fileapi/file_system_context.h" 30 #include "storage/browser/fileapi/file_system_context.h"
30 #include "storage/browser/fileapi/file_system_dir_url_request_job.h" 31 #include "storage/browser/fileapi/file_system_dir_url_request_job.h"
31 #include "storage/browser/fileapi/file_system_file_util.h" 32 #include "storage/browser/fileapi/file_system_file_util.h"
32 #include "storage/browser/fileapi/file_system_operation_context.h" 33 #include "storage/browser/fileapi/file_system_operation_context.h"
33 #include "storage/browser/fileapi/file_system_url.h" 34 #include "storage/browser/fileapi/file_system_url.h"
34 #include "storage/browser/test/mock_special_storage_policy.h" 35 #include "storage/browser/test/mock_special_storage_policy.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 173 }
173 174
174 void TestRequestHelper(const GURL& url, bool run_to_completion, 175 void TestRequestHelper(const GURL& url, bool run_to_completion,
175 FileSystemContext* file_system_context) { 176 FileSystemContext* file_system_context) {
176 delegate_.reset(new net::TestDelegate()); 177 delegate_.reset(new net::TestDelegate());
177 delegate_->set_quit_on_redirect(true); 178 delegate_->set_quit_on_redirect(true);
178 job_factory_.reset(new FileSystemDirURLRequestJobFactory( 179 job_factory_.reset(new FileSystemDirURLRequestJobFactory(
179 url.GetOrigin().host(), file_system_context)); 180 url.GetOrigin().host(), file_system_context));
180 empty_context_.set_job_factory(job_factory_.get()); 181 empty_context_.set_job_factory(job_factory_.get());
181 182
182 request_ = empty_context_.CreateRequest( 183 request_ = empty_context_.CreateRequest(url, net::DEFAULT_PRIORITY,
183 url, net::DEFAULT_PRIORITY, delegate_.get()); 184 delegate_.get(),
185 TRAFFIC_ANNOTATION_FOR_TESTS);
184 request_->Start(); 186 request_->Start();
185 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async 187 ASSERT_TRUE(request_->is_pending()); // verify that we're starting async
186 if (run_to_completion) 188 if (run_to_completion)
187 base::RunLoop().Run(); 189 base::RunLoop().Run();
188 } 190 }
189 191
190 void TestRequest(const GURL& url) { 192 void TestRequest(const GURL& url) {
191 TestRequestHelper(url, true, file_system_context_.get()); 193 TestRequestHelper(url, true, file_system_context_.get());
192 } 194 }
193 195
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 ASSERT_FALSE(request_->is_pending()); 449 ASSERT_FALSE(request_->is_pending());
448 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, delegate_->request_status()); 450 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, delegate_->request_status());
449 451
450 ASSERT_FALSE( 452 ASSERT_FALSE(
451 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( 453 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
452 kValidExternalMountPoint)); 454 kValidExternalMountPoint));
453 } 455 }
454 456
455 } // namespace 457 } // namespace
456 } // namespace content 458 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | storage/browser/fileapi/file_system_url_request_job_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698