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

Unified Diff: net/http/http_transaction_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_transaction_unittest.cc
diff --git a/net/http/http_transaction_unittest.cc b/net/http/http_transaction_unittest.cc
index 9480e61c9a7efcef155bedb56916b559dadcbab7..075bb135f2458d20cf146087d4e8dcd1b841c911 100644
--- a/net/http/http_transaction_unittest.cc
+++ b/net/http/http_transaction_unittest.cc
@@ -29,94 +29,51 @@ static MockTransactionMap mock_transactions;
// mock transaction data
const MockTransaction kSimpleGET_Transaction = {
- "http://www.google.com/",
- "GET",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "Cache-Control: max-age=10000\n",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/", "GET",
+ base::Time(), "",
+ net::LOAD_NORMAL, "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n", base::Time(),
+ "<html><body>Google Blah Blah</body></html>", TEST_MODE_NORMAL,
+ NULL, 0,
+ net::OK};
const MockTransaction kSimplePOST_Transaction = {
- "http://bugdatabase.com/edit",
- "POST",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://bugdatabase.com/edit", "POST",
+ base::Time(), "",
+ net::LOAD_NORMAL, "HTTP/1.1 200 OK",
+ "", base::Time(),
+ "<html><body>Google Blah Blah</body></html>", TEST_MODE_NORMAL,
+ NULL, 0,
+ net::OK};
const MockTransaction kTypicalGET_Transaction = {
- "http://www.example.com/~foo/bar.html",
- "GET",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "Date: Wed, 28 Nov 2007 09:40:09 GMT\n"
- "Last-Modified: Wed, 28 Nov 2007 00:40:09 GMT\n",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.example.com/~foo/bar.html", "GET", base::Time(), "",
+ net::LOAD_NORMAL, "HTTP/1.1 200 OK",
+ "Date: Wed, 28 Nov 2007 09:40:09 GMT\n"
+ "Last-Modified: Wed, 28 Nov 2007 00:40:09 GMT\n",
+ base::Time(), "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL, NULL, 0, net::OK};
const MockTransaction kETagGET_Transaction = {
- "http://www.google.com/foopy",
- "GET",
- base::Time(),
- "",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "Cache-Control: max-age=10000\n"
- "Etag: \"foopy\"\n",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/foopy", "GET", base::Time(), "", net::LOAD_NORMAL,
+ "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n"
+ "Etag: \"foopy\"\n",
+ base::Time(), "<html><body>Google Blah Blah</body></html>",
+ TEST_MODE_NORMAL, NULL, 0, net::OK};
const MockTransaction kRangeGET_Transaction = {
- "http://www.google.com/",
- "GET",
- base::Time(),
- "Range: 0-100\r\n",
- net::LOAD_NORMAL,
- "HTTP/1.1 200 OK",
- "Cache-Control: max-age=10000\n",
- base::Time(),
- "<html><body>Google Blah Blah</body></html>",
- TEST_MODE_NORMAL,
- NULL,
- 0,
- net::OK
-};
+ "http://www.google.com/", "GET",
+ base::Time(), "Range: 0-100\r\n",
+ net::LOAD_NORMAL, "HTTP/1.1 200 OK",
+ "Cache-Control: max-age=10000\n", base::Time(),
+ "<html><body>Google Blah Blah</body></html>", TEST_MODE_NORMAL,
+ NULL, 0,
+ net::OK};
static const MockTransaction* const kBuiltinMockTransactions[] = {
- &kSimpleGET_Transaction,
- &kSimplePOST_Transaction,
- &kTypicalGET_Transaction,
- &kETagGET_Transaction,
- &kRangeGET_Transaction
-};
+ &kSimpleGET_Transaction, &kSimplePOST_Transaction, &kTypicalGET_Transaction,
+ &kETagGET_Transaction, &kRangeGET_Transaction};
const MockTransaction* FindMockTransaction(const GURL& url) {
// look for overrides:
@@ -167,9 +124,10 @@ TestTransactionConsumer::~TestTransactionConsumer() {
void TestTransactionConsumer::Start(const net::HttpRequestInfo* request,
const net::BoundNetLog& net_log) {
state_ = STARTING;
- int result = trans_->Start(
- request, base::Bind(&TestTransactionConsumer::OnIOComplete,
- base::Unretained(this)), net_log);
+ int result = trans_->Start(request,
+ base::Bind(&TestTransactionConsumer::OnIOComplete,
+ base::Unretained(this)),
+ net_log);
if (result != net::ERR_IO_PENDING)
DidStart(result);
}
@@ -222,9 +180,8 @@ void TestTransactionConsumer::OnIOComplete(int result) {
}
}
-MockNetworkTransaction::MockNetworkTransaction(
- net::RequestPriority priority,
- MockNetworkLayer* factory)
+MockNetworkTransaction::MockNetworkTransaction(net::RequestPriority priority,
+ MockNetworkLayer* factory)
: weak_factory_(this),
request_(NULL),
data_cursor_(0),
@@ -235,7 +192,8 @@ MockNetworkTransaction::MockNetworkTransaction(
socket_log_id_(net::NetLog::Source::kInvalidId) {
}
-MockNetworkTransaction::~MockNetworkTransaction() {}
+MockNetworkTransaction::~MockNetworkTransaction() {
+}
int MockNetworkTransaction::Start(const net::HttpRequestInfo* request,
const net::CompletionCallback& callback,
@@ -281,7 +239,8 @@ bool MockNetworkTransaction::IsReadyToRestartForAuth() {
return request_->extra_headers.HasHeader("X-Require-Mock-Auth");
}
-int MockNetworkTransaction::Read(net::IOBuffer* buf, int buf_len,
+int MockNetworkTransaction::Read(net::IOBuffer* buf,
+ int buf_len,
const net::CompletionCallback& callback) {
int data_len = static_cast<int>(data_.size());
int num = std::min(buf_len, data_len - data_cursor_);
@@ -332,7 +291,8 @@ net::UploadProgress MockNetworkTransaction::GetUploadProgress() const {
}
void MockNetworkTransaction::SetQuicServerInfo(
- net::QuicServerInfo* quic_server_info) {}
+ net::QuicServerInfo* quic_server_info) {
+}
bool MockNetworkTransaction::GetLoadTimingInfo(
net::LoadTimingInfo* load_timing_info) const {
@@ -390,8 +350,8 @@ int MockNetworkTransaction::StartInternal(
if (t->handler)
(t->handler)(request, &resp_status, &resp_headers, &resp_data);
- std::string header_data = base::StringPrintf(
- "%s\n%s\n", resp_status.c_str(), resp_headers.c_str());
+ std::string header_data =
+ base::StringPrintf("%s\n%s\n", resp_status.c_str(), resp_headers.c_str());
std::replace(header_data.begin(), header_data.end(), '\n', '\0');
response_.request_time = base::Time::Now();
@@ -430,14 +390,19 @@ int MockNetworkTransaction::ResumeNetworkStart() {
}
void MockNetworkTransaction::CallbackLater(
- const net::CompletionCallback& callback, int result) {
+ const net::CompletionCallback& callback,
+ int result) {
base::MessageLoop::current()->PostTask(
- FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback,
- weak_factory_.GetWeakPtr(), callback, result));
+ FROM_HERE,
+ base::Bind(&MockNetworkTransaction::RunCallback,
+ weak_factory_.GetWeakPtr(),
+ callback,
+ result));
}
void MockNetworkTransaction::RunCallback(
- const net::CompletionCallback& callback, int result) {
+ const net::CompletionCallback& callback,
+ int result) {
callback.Run(result);
}
@@ -445,9 +410,11 @@ MockNetworkLayer::MockNetworkLayer()
: transaction_count_(0),
done_reading_called_(false),
stop_caching_called_(false),
- last_create_transaction_priority_(net::DEFAULT_PRIORITY) {}
+ last_create_transaction_priority_(net::DEFAULT_PRIORITY) {
+}
-MockNetworkLayer::~MockNetworkLayer() {}
+MockNetworkLayer::~MockNetworkLayer() {
+}
void MockNetworkLayer::TransactionDoneReading() {
done_reading_called_ = true;

Powered by Google App Engine
This is Rietveld 408576698