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

Side by Side Diff: webkit/fileapi/file_system_url_request_job_unittest.cc

Issue 10829147: Make MediaFileUtil run on thread pool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/fileapi/file_system_url_request_job.h" 5 #include "webkit/fileapi/file_system_url_request_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 11 matching lines...) Expand all
22 #include "net/base/mime_util.h" 22 #include "net/base/mime_util.h"
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/base/net_util.h" 24 #include "net/base/net_util.h"
25 #include "net/http/http_request_headers.h" 25 #include "net/http/http_request_headers.h"
26 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
27 #include "net/url_request/url_request_test_util.h" 27 #include "net/url_request/url_request_test_util.h"
28 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
29 #include "webkit/fileapi/file_system_context.h" 29 #include "webkit/fileapi/file_system_context.h"
30 #include "webkit/fileapi/file_system_file_util.h" 30 #include "webkit/fileapi/file_system_file_util.h"
31 #include "webkit/fileapi/file_system_operation_context.h" 31 #include "webkit/fileapi/file_system_operation_context.h"
32 #include "webkit/fileapi/file_system_task_runners.h"
32 #include "webkit/fileapi/mock_file_system_options.h" 33 #include "webkit/fileapi/mock_file_system_options.h"
33 #include "webkit/fileapi/sandbox_mount_point_provider.h" 34 #include "webkit/fileapi/sandbox_mount_point_provider.h"
34 #include "webkit/quota/mock_special_storage_policy.h" 35 #include "webkit/quota/mock_special_storage_policy.h"
35 36
36 namespace fileapi { 37 namespace fileapi {
37 namespace { 38 namespace {
38 39
39 // We always use the TEMPORARY FileSystem in this test. 40 // We always use the TEMPORARY FileSystem in this test.
40 const char kFileSystemURLPrefix[] = "filesystem:http://remote/temporary/"; 41 const char kFileSystemURLPrefix[] = "filesystem:http://remote/temporary/";
41 const char kTestFileData[] = "0123456789"; 42 const char kTestFileData[] = "0123456789";
(...skipping 23 matching lines...) Expand all
65 } 66 }
66 67
67 virtual void SetUp() OVERRIDE { 68 virtual void SetUp() OVERRIDE {
68 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 69 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
69 70
70 special_storage_policy_ = new quota::MockSpecialStoragePolicy; 71 special_storage_policy_ = new quota::MockSpecialStoragePolicy;
71 // We use the main thread so that we can get the root path synchronously. 72 // We use the main thread so that we can get the root path synchronously.
72 // TODO(adamk): Run this on the FILE thread we've created as well. 73 // TODO(adamk): Run this on the FILE thread we've created as well.
73 file_system_context_ = 74 file_system_context_ =
74 new FileSystemContext( 75 new FileSystemContext(
75 base::MessageLoopProxy::current(), 76 FileSystemTaskRunners::CreateMockTaskRunners(),
76 base::MessageLoopProxy::current(),
77 special_storage_policy_, NULL, 77 special_storage_policy_, NULL,
78 temp_dir_.path(), 78 temp_dir_.path(),
79 CreateDisallowFileAccessOptions()); 79 CreateDisallowFileAccessOptions());
80 80
81 file_system_context_->sandbox_provider()->ValidateFileSystemRoot( 81 file_system_context_->sandbox_provider()->ValidateFileSystemRoot(
82 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create 82 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create
83 base::Bind(&FileSystemURLRequestJobTest::OnValidateFileSystem, 83 base::Bind(&FileSystemURLRequestJobTest::OnValidateFileSystem,
84 weak_factory_.GetWeakPtr())); 84 weak_factory_.GetWeakPtr()));
85 MessageLoop::current()->RunAllPending(); 85 MessageLoop::current()->RunAllPending();
86 86
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 TestRequest(CreateFileSystemURL(kFilename)); 367 TestRequest(CreateFileSystemURL(kFilename));
368 368
369 std::string mime_type_from_job; 369 std::string mime_type_from_job;
370 request_->GetMimeType(&mime_type_from_job); 370 request_->GetMimeType(&mime_type_from_job);
371 EXPECT_EQ(mime_type_direct, mime_type_from_job); 371 EXPECT_EQ(mime_type_direct, mime_type_from_job);
372 } 372 }
373 373
374 } // namespace 374 } // namespace
375 } // namespace fileapi 375 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698