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

Side by Side Diff: net/url_request/view_cache_helper_unittest.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | net/websockets/websocket_throttle_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/url_request/view_cache_helper.h" 5 #include "net/url_request/view_cache_helper.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "net/base/test_completion_callback.h" 8 #include "net/base/test_completion_callback.h"
9 #include "net/disk_cache/disk_cache.h" 9 #include "net/disk_cache/disk_cache.h"
10 #include "net/http/http_cache.h" 10 #include "net/http/http_cache.h"
(...skipping 22 matching lines...) Expand all
33 void WriteHeaders(disk_cache::Entry* entry, int flags, const std::string data) { 33 void WriteHeaders(disk_cache::Entry* entry, int flags, const std::string data) {
34 if (data.empty()) 34 if (data.empty())
35 return; 35 return;
36 36
37 Pickle pickle; 37 Pickle pickle;
38 pickle.WriteInt(flags | 1); // Version 1. 38 pickle.WriteInt(flags | 1); // Version 1.
39 pickle.WriteInt64(0); 39 pickle.WriteInt64(0);
40 pickle.WriteInt64(0); 40 pickle.WriteInt64(0);
41 pickle.WriteString(data); 41 pickle.WriteString(data);
42 42
43 scoped_refptr<net::WrappedIOBuffer> buf = new net::WrappedIOBuffer( 43 scoped_refptr<net::WrappedIOBuffer> buf(new net::WrappedIOBuffer(
44 reinterpret_cast<const char*>(pickle.data())); 44 reinterpret_cast<const char*>(pickle.data())));
45 int len = static_cast<int>(pickle.size()); 45 int len = static_cast<int>(pickle.size());
46 46
47 TestCompletionCallback cb; 47 TestCompletionCallback cb;
48 int rv = entry->WriteData(0, 0, buf, len, &cb, true); 48 int rv = entry->WriteData(0, 0, buf, len, &cb, true);
49 ASSERT_EQ(len, cb.GetResult(rv)); 49 ASSERT_EQ(len, cb.GetResult(rv));
50 } 50 }
51 51
52 void WriteData(disk_cache::Entry* entry, int index, const std::string data) { 52 void WriteData(disk_cache::Entry* entry, int index, const std::string data) {
53 if (data.empty()) 53 if (data.empty())
54 return; 54 return;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 int flags = 1 << 12; 192 int flags = 1 << 12;
193 WriteHeaders(entry, flags, "something"); 193 WriteHeaders(entry, flags, "something");
194 entry->Close(); 194 entry->Close();
195 195
196 std::string data; 196 std::string data;
197 rv = helper.GetEntryInfoHTML(key, context, &data, &cb); 197 rv = helper.GetEntryInfoHTML(key, context, &data, &cb);
198 EXPECT_EQ(net::OK, cb.GetResult(rv)); 198 EXPECT_EQ(net::OK, cb.GetResult(rv));
199 199
200 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED")); 200 EXPECT_NE(std::string::npos, data.find("RESPONSE_INFO_TRUNCATED"));
201 } 201 }
OLDNEW
« no previous file with comments | « net/url_request/url_request_unittest.cc ('k') | net/websockets/websocket_throttle_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698