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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
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 <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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 virtual ~TestProtocolHandler() {} 631 virtual ~TestProtocolHandler() {}
632 632
633 virtual net::URLRequestJob* MaybeCreateJob( 633 virtual net::URLRequestJob* MaybeCreateJob(
634 net::URLRequest* request, 634 net::URLRequest* request,
635 net::NetworkDelegate* network_delegate) const OVERRIDE { 635 net::NetworkDelegate* network_delegate) const OVERRIDE {
636 return new webkit_blob::BlobURLRequestJob( 636 return new webkit_blob::BlobURLRequestJob(
637 request, 637 request,
638 network_delegate, 638 network_delegate,
639 blob_storage_controller_->GetBlobDataFromUrl(request->url()), 639 blob_storage_controller_->GetBlobDataFromUrl(request->url()),
640 file_system_context_, 640 file_system_context_,
641 base::MessageLoopProxy::current()); 641 base::MessageLoopProxy::current().get());
642 } 642 }
643 643
644 private: 644 private:
645 webkit_blob::BlobStorageController* const blob_storage_controller_; 645 webkit_blob::BlobStorageController* const blob_storage_controller_;
646 fileapi::FileSystemContext* const file_system_context_; 646 fileapi::FileSystemContext* const file_system_context_;
647 647
648 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler); 648 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler);
649 }; 649 };
650 650
651 class TestURLRequestContext : public net::URLRequestContext { 651 class TestURLRequestContext : public net::URLRequestContext {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 kExclusive, base::Bind( 741 kExclusive, base::Bind(
742 &HTML5FileWriter::CreateFileCallback, base::Unretained(this))); 742 &HTML5FileWriter::CreateFileCallback, base::Unretained(this)));
743 } 743 }
744 744
745 void CreateFileCallback(base::PlatformFileError result) { 745 void CreateFileCallback(base::PlatformFileError result) {
746 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 746 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
747 CHECK_EQ(base::PLATFORM_FILE_OK, result); 747 CHECK_EQ(base::PLATFORM_FILE_OK, result);
748 blob_data_->AppendData(payload_); 748 blob_data_->AppendData(payload_);
749 url_request_context_.reset(new TestURLRequestContext(fs_)); 749 url_request_context_.reset(new TestURLRequestContext(fs_));
750 url_request_context_->blob_storage_controller()->AddFinishedBlob( 750 url_request_context_->blob_storage_controller()->AddFinishedBlob(
751 blob_url(), blob_data_); 751 blob_url(), blob_data_.get());
752 operation()->Write( 752 operation()->Write(
753 url_request_context_.get(), 753 url_request_context_.get(),
754 fileapi::FileSystemURL(GURL(root_ + filename_)), 754 fileapi::FileSystemURL(GURL(root_ + filename_)),
755 blob_url(), 755 blob_url(),
756 0, // offset 756 0, // offset
757 base::Bind(&HTML5FileWriter::WriteCallback, base::Unretained(this))); 757 base::Bind(&HTML5FileWriter::WriteCallback, base::Unretained(this)));
758 } 758 }
759 759
760 void WriteCallback( 760 void WriteCallback(
761 base::PlatformFileError result, 761 base::PlatformFileError result,
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2083 " \"state\": {" 2083 " \"state\": {"
2084 " \"previous\": \"in_progress\"," 2084 " \"previous\": \"in_progress\","
2085 " \"current\": \"complete\"}}]", 2085 " \"current\": \"complete\"}}]",
2086 result_id, 2086 result_id,
2087 GetFilename("on_record.txt.crdownload").c_str(), 2087 GetFilename("on_record.txt.crdownload").c_str(),
2088 GetFilename("on_record.txt").c_str()))); 2088 GetFilename("on_record.txt").c_str())));
2089 std::string disk_data; 2089 std::string disk_data;
2090 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2090 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2091 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2091 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2092 } 2092 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698