OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/renderer_host/websocket_blob_sender.h" | 5 #include "content/browser/renderer_host/websocket_blob_sender.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 149 |
150 // Call sender_.Start() with the other parameters filled in appropriately for | 150 // Call sender_.Start() with the other parameters filled in appropriately for |
151 // this test fixture. | 151 // this test fixture. |
152 int Start(const std::string& uuid, | 152 int Start(const std::string& uuid, |
153 uint64_t expected_size, | 153 uint64_t expected_size, |
154 const net::CompletionCallback& callback) { | 154 const net::CompletionCallback& callback) { |
155 net::WebSocketEventInterface::ChannelState channel_state = | 155 net::WebSocketEventInterface::ChannelState channel_state = |
156 net::WebSocketEventInterface::CHANNEL_ALIVE; | 156 net::WebSocketEventInterface::CHANNEL_ALIVE; |
157 return sender_->Start( | 157 return sender_->Start( |
158 uuid, expected_size, context(), GetFileSystemContext(), | 158 uuid, expected_size, context(), GetFileSystemContext(), |
159 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(), | 159 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE).get(), |
160 &channel_state, callback); | 160 &channel_state, callback); |
161 } | 161 } |
162 | 162 |
163 void NotCalledCallbackImpl(int rv) { | 163 void NotCalledCallbackImpl(int rv) { |
164 ADD_FAILURE() | 164 ADD_FAILURE() |
165 << "Callback that should not be called was called with argument " << rv; | 165 << "Callback that should not be called was called with argument " << rv; |
166 } | 166 } |
167 | 167 |
168 net::CompletionCallback NotCalled() { | 168 net::CompletionCallback NotCalled() { |
169 return base::Bind(&WebSocketBlobSenderTest::NotCalledCallbackImpl, | 169 return base::Bind(&WebSocketBlobSenderTest::NotCalledCallbackImpl, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 | 441 |
442 int rv = Start(handle->GetUUID(), message.size(), NotCalled()); | 442 int rv = Start(handle->GetUUID(), message.size(), NotCalled()); |
443 EXPECT_EQ(net::OK, rv); | 443 EXPECT_EQ(net::OK, rv); |
444 std::vector<char> expected_message(message.begin(), message.end()); | 444 std::vector<char> expected_message(message.begin(), message.end()); |
445 EXPECT_EQ(expected_message, synchronous_fake_channel_->message()); | 445 EXPECT_EQ(expected_message, synchronous_fake_channel_->message()); |
446 } | 446 } |
447 | 447 |
448 } // namespace | 448 } // namespace |
449 | 449 |
450 } // namespace content | 450 } // namespace content |
OLD | NEW |