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

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

Issue 10855209: Refactoring: ProtocolHandler::MaybeCreateJob takes NetworkDelegate as argument (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest merge 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 <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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 619
620 class TestProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { 620 class TestProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
621 public: 621 public:
622 explicit TestProtocolHandler( 622 explicit TestProtocolHandler(
623 webkit_blob::BlobStorageController* blob_storage_controller) 623 webkit_blob::BlobStorageController* blob_storage_controller)
624 : blob_storage_controller_(blob_storage_controller) {} 624 : blob_storage_controller_(blob_storage_controller) {}
625 625
626 virtual ~TestProtocolHandler() {} 626 virtual ~TestProtocolHandler() {}
627 627
628 virtual net::URLRequestJob* MaybeCreateJob( 628 virtual net::URLRequestJob* MaybeCreateJob(
629 net::URLRequest* request) const OVERRIDE { 629 net::URLRequest* request,
630 net::NetworkDelegate* network_delegate) const OVERRIDE {
630 return new webkit_blob::BlobURLRequestJob( 631 return new webkit_blob::BlobURLRequestJob(
631 request, 632 request,
633 network_delegate,
632 blob_storage_controller_->GetBlobDataFromUrl(request->url()), 634 blob_storage_controller_->GetBlobDataFromUrl(request->url()),
633 base::MessageLoopProxy::current()); 635 base::MessageLoopProxy::current());
634 } 636 }
635 637
636 private: 638 private:
637 webkit_blob::BlobStorageController* const blob_storage_controller_; 639 webkit_blob::BlobStorageController* const blob_storage_controller_;
638 640
639 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler); 641 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler);
640 }; 642 };
641 643
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 " \"state\": {" 2083 " \"state\": {"
2082 " \"previous\": \"in_progress\"," 2084 " \"previous\": \"in_progress\","
2083 " \"current\": \"complete\"}}]", 2085 " \"current\": \"complete\"}}]",
2084 result_id, 2086 result_id,
2085 GetFilename("on_record.txt.crdownload").c_str(), 2087 GetFilename("on_record.txt.crdownload").c_str(),
2086 GetFilename("on_record.txt").c_str()))); 2088 GetFilename("on_record.txt").c_str())));
2087 std::string disk_data; 2089 std::string disk_data;
2088 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2090 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2089 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2091 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2090 } 2092 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698