OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" | 31 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" |
32 #include "third_party/mojo/src/mojo/public/cpp/application/application_test_base
.h" | 32 #include "third_party/mojo/src/mojo/public/cpp/application/application_test_base
.h" |
33 | 33 |
34 namespace mojo { | 34 namespace mojo { |
35 namespace { | 35 namespace { |
36 | 36 |
37 const int kMaxExpectedResponseLength = 2048; | 37 const int kMaxExpectedResponseLength = 2048; |
38 | 38 |
39 NetAddressPtr GetLocalHostWithAnyPort() { | 39 NetAddressPtr GetLocalHostWithAnyPort() { |
40 NetAddressPtr addr(NetAddress::New()); | 40 NetAddressPtr addr(NetAddress::New()); |
41 addr->family = NET_ADDRESS_FAMILY_IPV4; | 41 addr->family = NetAddressFamily::IPV4; |
42 addr->ipv4 = NetAddressIPv4::New(); | 42 addr->ipv4 = NetAddressIPv4::New(); |
43 addr->ipv4->port = 0; | 43 addr->ipv4->port = 0; |
44 addr->ipv4->addr.resize(4); | 44 addr->ipv4->addr.resize(4); |
45 addr->ipv4->addr[0] = 127; | 45 addr->ipv4->addr[0] = 127; |
46 addr->ipv4->addr[1] = 0; | 46 addr->ipv4->addr[1] = 0; |
47 addr->ipv4->addr[2] = 0; | 47 addr->ipv4->addr[2] = 0; |
48 addr->ipv4->addr[3] = 1; | 48 addr->ipv4->addr[3] = 1; |
49 | 49 |
50 return addr.Pass(); | 50 return addr.Pass(); |
51 } | 51 } |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 void DidReceiveFlowControl(int64_t quota) override {} | 366 void DidReceiveFlowControl(int64_t quota) override {} |
367 | 367 |
368 void DidFail(const String& message) override {} | 368 void DidFail(const String& message) override {} |
369 | 369 |
370 void DidClose(bool was_clean, uint16_t code, const String& reason) override {} | 370 void DidClose(bool was_clean, uint16_t code, const String& reason) override {} |
371 | 371 |
372 void OnFinishedWritingSendStream(uint32_t num_bytes, const char* buffer) { | 372 void OnFinishedWritingSendStream(uint32_t num_bytes, const char* buffer) { |
373 EXPECT_TRUE(buffer); | 373 EXPECT_TRUE(buffer); |
374 | 374 |
375 web_socket_->Send(true, WebSocket::MESSAGE_TYPE_TEXT, num_bytes); | 375 web_socket_->Send(true, WebSocket::MessageType::TEXT, num_bytes); |
376 } | 376 } |
377 | 377 |
378 void OnFinishedReadingReceiveStream(uint32_t num_bytes, const char* data) { | 378 void OnFinishedReadingReceiveStream(uint32_t num_bytes, const char* data) { |
379 EXPECT_TRUE(data); | 379 EXPECT_TRUE(data); |
380 | 380 |
381 received_messages_.push_back(std::string(data, num_bytes)); | 381 received_messages_.push_back(std::string(data, num_bytes)); |
382 if (run_loop_ && received_messages_.size() >= wait_for_message_count_) { | 382 if (run_loop_ && received_messages_.size() >= wait_for_message_count_) { |
383 wait_for_message_count_ = 0; | 383 wait_for_message_count_ = 0; |
384 run_loop_->Quit(); | 384 run_loop_->Quit(); |
385 } | 385 } |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 680 |
681 socket_1.Send("How do"); | 681 socket_1.Send("How do"); |
682 socket_1.Send("you do?"); | 682 socket_1.Send("you do?"); |
683 | 683 |
684 socket_0.WaitForMessage(2); | 684 socket_0.WaitForMessage(2); |
685 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 685 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
686 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 686 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
687 } | 687 } |
688 | 688 |
689 } // namespace mojo | 689 } // namespace mojo |
OLD | NEW |