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

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: 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 643
644 class TestProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { 644 class TestProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler {
645 public: 645 public:
646 explicit TestProtocolHandler( 646 explicit TestProtocolHandler(
647 webkit_blob::BlobStorageController* blob_storage_controller) 647 webkit_blob::BlobStorageController* blob_storage_controller)
648 : blob_storage_controller_(blob_storage_controller) {} 648 : blob_storage_controller_(blob_storage_controller) {}
649 649
650 virtual ~TestProtocolHandler() {} 650 virtual ~TestProtocolHandler() {}
651 651
652 virtual net::URLRequestJob* MaybeCreateJob( 652 virtual net::URLRequestJob* MaybeCreateJob(
653 net::URLRequest* request) const OVERRIDE { 653 net::URLRequest* request,
654 net::NetworkDelegate* network_delegate) const OVERRIDE {
654 return new webkit_blob::BlobURLRequestJob( 655 return new webkit_blob::BlobURLRequestJob(
655 request, 656 request,
657 network_delegate,
656 blob_storage_controller_->GetBlobDataFromUrl(request->url()), 658 blob_storage_controller_->GetBlobDataFromUrl(request->url()),
657 base::MessageLoopProxy::current()); 659 base::MessageLoopProxy::current());
658 } 660 }
659 661
660 private: 662 private:
661 webkit_blob::BlobStorageController* const blob_storage_controller_; 663 webkit_blob::BlobStorageController* const blob_storage_controller_;
662 664
663 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler); 665 DISALLOW_COPY_AND_ASSIGN(TestProtocolHandler);
664 }; 666 };
665 667
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 " \"state\": {" 2157 " \"state\": {"
2156 " \"previous\": \"in_progress\"," 2158 " \"previous\": \"in_progress\","
2157 " \"current\": \"complete\"}}]", 2159 " \"current\": \"complete\"}}]",
2158 result_id, 2160 result_id,
2159 GetFilename("on_record.txt.crdownload").c_str(), 2161 GetFilename("on_record.txt.crdownload").c_str(),
2160 GetFilename("on_record.txt").c_str()))); 2162 GetFilename("on_record.txt").c_str())));
2161 std::string disk_data; 2163 std::string disk_data;
2162 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); 2164 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data));
2163 EXPECT_STREQ(kPayloadData, disk_data.c_str()); 2165 EXPECT_STREQ(kPayloadData, disk_data.c_str());
2164 } 2166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698