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/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); | 763 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); |
764 events_listener_->WaitFor( | 764 events_listener_->WaitFor( |
765 profile_, kURLRequestContextToreDown, std::string()); | 765 profile_, kURLRequestContextToreDown, std::string()); |
766 } | 766 } |
767 | 767 |
768 bool WriteFile() { | 768 bool WriteFile() { |
769 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 769 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
770 fs_->OpenFileSystem( | 770 fs_->OpenFileSystem( |
771 GURL(origin_), | 771 GURL(origin_), |
772 fileapi::kFileSystemTypeTemporary, | 772 fileapi::kFileSystemTypeTemporary, |
773 kCreateFileSystem, | 773 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
774 base::Bind(&HTML5FileWriter::OpenFileSystemCallback, | 774 base::Bind(&HTML5FileWriter::OpenFileSystemCallback, |
775 base::Unretained(this))); | 775 base::Unretained(this))); |
776 return events_listener_->WaitFor(profile_, kHTML5FileWritten, filename_); | 776 return events_listener_->WaitFor(profile_, kHTML5FileWritten, filename_); |
777 } | 777 } |
778 | 778 |
779 private: | 779 private: |
780 static const char kHTML5FileWritten[]; | 780 static const char kHTML5FileWritten[]; |
781 static const char kURLRequestContextToreDown[]; | 781 static const char kURLRequestContextToreDown[]; |
782 static const bool kExclusive = true; | 782 static const bool kExclusive = true; |
783 static const bool kCreateFileSystem = true; | |
784 | 783 |
785 GURL blob_url() const { return GURL("blob:" + filename_); } | 784 GURL blob_url() const { return GURL("blob:" + filename_); } |
786 | 785 |
787 void OpenFileSystemCallback( | 786 void OpenFileSystemCallback( |
788 base::PlatformFileError result, | 787 base::PlatformFileError result, |
789 const std::string& fs_name, | 788 const std::string& fs_name, |
790 const GURL& root) { | 789 const GURL& root) { |
791 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 790 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
792 root_ = root.spec(); | 791 root_ = root.spec(); |
793 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( | 792 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( |
(...skipping 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3479 DownloadsApiTest() {} | 3478 DownloadsApiTest() {} |
3480 virtual ~DownloadsApiTest() {} | 3479 virtual ~DownloadsApiTest() {} |
3481 private: | 3480 private: |
3482 DISALLOW_COPY_AND_ASSIGN(DownloadsApiTest); | 3481 DISALLOW_COPY_AND_ASSIGN(DownloadsApiTest); |
3483 }; | 3482 }; |
3484 | 3483 |
3485 | 3484 |
3486 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, DownloadsApiTest) { | 3485 IN_PROC_BROWSER_TEST_F(DownloadsApiTest, DownloadsApiTest) { |
3487 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; | 3486 ASSERT_TRUE(RunExtensionTest("downloads")) << message_; |
3488 } | 3487 } |
OLD | NEW |