OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 base::PlatformFileError result, | 715 base::PlatformFileError result, |
716 const std::string& fs_name, | 716 const std::string& fs_name, |
717 const GURL& root) { | 717 const GURL& root) { |
718 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 718 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
719 root_ = root.spec(); | 719 root_ = root.spec(); |
720 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 720 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( |
721 &HTML5FileWriter::CreateFile, base::Unretained(this)))); | 721 &HTML5FileWriter::CreateFile, base::Unretained(this)))); |
722 } | 722 } |
723 | 723 |
724 fileapi::FileSystemOperation* operation() { | 724 fileapi::FileSystemOperation* operation() { |
725 return fs_->CreateFileSystemOperation(fileapi::FileSystemURL(GURL(root_))); | 725 return fs_->CreateFileSystemOperation( |
| 726 fileapi::FileSystemURL(GURL(root_)), NULL); |
726 } | 727 } |
727 | 728 |
728 void CreateFile() { | 729 void CreateFile() { |
729 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 730 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
730 operation()->CreateFile(fileapi::FileSystemURL(GURL(root_ + filename_)), | 731 operation()->CreateFile(fileapi::FileSystemURL(GURL(root_ + filename_)), |
731 kExclusive, base::Bind( | 732 kExclusive, base::Bind( |
732 &HTML5FileWriter::CreateFileCallback, base::Unretained(this))); | 733 &HTML5FileWriter::CreateFileCallback, base::Unretained(this))); |
733 } | 734 } |
734 | 735 |
735 void CreateFileCallback(base::PlatformFileError result) { | 736 void CreateFileCallback(base::PlatformFileError result) { |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 " \"state\": {" | 2085 " \"state\": {" |
2085 " \"previous\": \"in_progress\"," | 2086 " \"previous\": \"in_progress\"," |
2086 " \"current\": \"complete\"}}]", | 2087 " \"current\": \"complete\"}}]", |
2087 result_id, | 2088 result_id, |
2088 GetFilename("on_record.txt.crdownload").c_str(), | 2089 GetFilename("on_record.txt.crdownload").c_str(), |
2089 GetFilename("on_record.txt").c_str()))); | 2090 GetFilename("on_record.txt").c_str()))); |
2090 std::string disk_data; | 2091 std::string disk_data; |
2091 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2092 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
2092 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2093 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
2093 } | 2094 } |
OLD | NEW |