| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/websockets/websocket_job.h" | 5 #include "net/websockets/websocket_job.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 const DeleteCallback& callback) override { | 221 const DeleteCallback& callback) override { |
| 222 ADD_FAILURE(); | 222 ADD_FAILURE(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void DeleteSessionCookiesAsync(const DeleteCallback&) override { | 225 void DeleteSessionCookiesAsync(const DeleteCallback&) override { |
| 226 ADD_FAILURE(); | 226 ADD_FAILURE(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 CookieMonster* GetCookieMonster() override { return NULL; } | 229 CookieMonster* GetCookieMonster() override { return NULL; } |
| 230 | 230 |
| 231 scoped_ptr<CookieStore::CookieChangedSubscription> |
| 232 AddCallbackForCookie(const GURL& url, const std::string& name, |
| 233 const CookieChangedCallback& callback) override { |
| 234 ADD_FAILURE(); |
| 235 return scoped_ptr<CookieChangedSubscription>(); |
| 236 } |
| 237 |
| 231 const std::vector<Entry>& entries() const { return entries_; } | 238 const std::vector<Entry>& entries() const { return entries_; } |
| 232 | 239 |
| 233 private: | 240 private: |
| 234 friend class base::RefCountedThreadSafe<MockCookieStore>; | 241 friend class base::RefCountedThreadSafe<MockCookieStore>; |
| 235 ~MockCookieStore() override {} | 242 ~MockCookieStore() override {} |
| 236 | 243 |
| 237 std::vector<Entry> entries_; | 244 std::vector<Entry> entries_; |
| 238 }; | 245 }; |
| 239 | 246 |
| 240 class MockSSLConfigService : public SSLConfigService { | 247 class MockSSLConfigService : public SSLConfigService { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 | 384 |
| 378 } // namespace | 385 } // namespace |
| 379 | 386 |
| 380 class WebSocketJobTest : public PlatformTest, | 387 class WebSocketJobTest : public PlatformTest, |
| 381 public ::testing::WithParamInterface<NextProto> { | 388 public ::testing::WithParamInterface<NextProto> { |
| 382 public: | 389 public: |
| 383 WebSocketJobTest() | 390 WebSocketJobTest() |
| 384 : spdy_util_(GetParam()), | 391 : spdy_util_(GetParam()), |
| 385 enable_websocket_over_spdy_(false) {} | 392 enable_websocket_over_spdy_(false) {} |
| 386 | 393 |
| 387 virtual void SetUp() override { | 394 void SetUp() override { |
| 388 stream_type_ = STREAM_INVALID; | 395 stream_type_ = STREAM_INVALID; |
| 389 cookie_store_ = new MockCookieStore; | 396 cookie_store_ = new MockCookieStore; |
| 390 context_.reset(new MockURLRequestContext(cookie_store_.get())); | 397 context_.reset(new MockURLRequestContext(cookie_store_.get())); |
| 391 } | 398 } |
| 392 virtual void TearDown() override { | 399 void TearDown() override { |
| 393 cookie_store_ = NULL; | 400 cookie_store_ = NULL; |
| 394 context_.reset(); | 401 context_.reset(); |
| 395 websocket_ = NULL; | 402 websocket_ = NULL; |
| 396 socket_ = NULL; | 403 socket_ = NULL; |
| 397 } | 404 } |
| 398 void DoSendRequest() { | 405 void DoSendRequest() { |
| 399 EXPECT_TRUE(websocket_->SendData(kHandshakeRequestWithoutCookie, | 406 EXPECT_TRUE(websocket_->SendData(kHandshakeRequestWithoutCookie, |
| 400 kHandshakeRequestWithoutCookieLength)); | 407 kHandshakeRequestWithoutCookieLength)); |
| 401 } | 408 } |
| 402 void DoSendData() { | 409 void DoSendData() { |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 job()->Connect(); | 1278 job()->Connect(); |
| 1272 SetDeleteNext(); | 1279 SetDeleteNext(); |
| 1273 job()->OnReceivedData( | 1280 job()->OnReceivedData( |
| 1274 socket_.get(), kMinimalResponse, arraysize(kMinimalResponse) - 1); | 1281 socket_.get(), kMinimalResponse, arraysize(kMinimalResponse) - 1); |
| 1275 EXPECT_FALSE(job()); | 1282 EXPECT_FALSE(job()); |
| 1276 } | 1283 } |
| 1277 | 1284 |
| 1278 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. | 1285 // TODO(toyoshim): Add tests to verify throttling, SPDY stream limitation. |
| 1279 // TODO(toyoshim,yutak): Add tests to verify closing handshake. | 1286 // TODO(toyoshim,yutak): Add tests to verify closing handshake. |
| 1280 } // namespace net | 1287 } // namespace net |
| OLD | NEW |