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

Side by Side Diff: net/websockets/websocket_channel_test.cc

Issue 26544003: Make net::WebSocketChannel deletion safe and enable new IPCs (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add missing OVERRIDE annotation. Created 7 years, 2 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 unified diff | Download patch
OLDNEW
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_channel.h" 5 #include "net/websockets/websocket_channel.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <iostream> 9 #include <iostream>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/callback.h" 15 #include "base/callback.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/memory/scoped_vector.h" 18 #include "base/memory/scoped_vector.h"
19 #include "base/memory/weak_ptr.h"
19 #include "base/message_loop/message_loop.h" 20 #include "base/message_loop/message_loop.h"
20 #include "base/safe_numerics.h" 21 #include "base/safe_numerics.h"
21 #include "base/strings/string_piece.h" 22 #include "base/strings/string_piece.h"
22 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
23 #include "net/url_request/url_request_context.h" 24 #include "net/url_request/url_request_context.h"
24 #include "net/websockets/websocket_errors.h" 25 #include "net/websockets/websocket_errors.h"
25 #include "net/websockets/websocket_event_interface.h" 26 #include "net/websockets/websocket_event_interface.h"
26 #include "net/websockets/websocket_mux.h" 27 #include "net/websockets/websocket_mux.h"
27 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 79 }
79 80
80 std::ostream& operator<<(std::ostream& os, 81 std::ostream& operator<<(std::ostream& os,
81 const ScopedVector<WebSocketFrame>* vector) { 82 const ScopedVector<WebSocketFrame>* vector) {
82 return os << '&' << *vector; 83 return os << '&' << *vector;
83 } 84 }
84 85
85 namespace { 86 namespace {
86 87
87 using ::testing::AnyNumber; 88 using ::testing::AnyNumber;
89 using ::testing::DefaultValue;
88 using ::testing::InSequence; 90 using ::testing::InSequence;
89 using ::testing::MockFunction; 91 using ::testing::MockFunction;
90 using ::testing::Return; 92 using ::testing::Return;
91 using ::testing::SaveArg; 93 using ::testing::SaveArg;
92 using ::testing::StrictMock; 94 using ::testing::StrictMock;
93 using ::testing::_; 95 using ::testing::_;
94 96
95 // A selection of characters that have traditionally been mangled in some 97 // A selection of characters that have traditionally been mangled in some
96 // environment or other, for testing 8-bit cleanliness. 98 // environment or other, for testing 8-bit cleanliness.
97 const char kBinaryBlob[] = {'\n', '\r', // BACKWARDS CRNL 99 const char kBinaryBlob[] = {'\n', '\r', // BACKWARDS CRNL
(...skipping 11 matching lines...) Expand all
109 111
110 // The amount of quota a new connection gets by default. 112 // The amount of quota a new connection gets by default.
111 // TODO(ricea): If kDefaultSendQuotaHighWaterMark changes, then this value will 113 // TODO(ricea): If kDefaultSendQuotaHighWaterMark changes, then this value will
112 // need to be updated. 114 // need to be updated.
113 const size_t kDefaultInitialQuota = 1 << 17; 115 const size_t kDefaultInitialQuota = 1 << 17;
114 // The amount of bytes we need to send after the initial connection to trigger a 116 // The amount of bytes we need to send after the initial connection to trigger a
115 // quota refresh. TODO(ricea): Change this if kDefaultSendQuotaHighWaterMark or 117 // quota refresh. TODO(ricea): Change this if kDefaultSendQuotaHighWaterMark or
116 // kDefaultSendQuotaLowWaterMark change. 118 // kDefaultSendQuotaLowWaterMark change.
117 const size_t kDefaultQuotaRefreshTrigger = (1 << 16) + 1; 119 const size_t kDefaultQuotaRefreshTrigger = (1 << 16) + 1;
118 120
121 typedef WebSocketEventInterface::ChannelState ChannelState;
122 const ChannelState CHANNEL_ALIVE = WebSocketEventInterface::CHANNEL_ALIVE;
123 const ChannelState CHANNEL_DELETED = WebSocketEventInterface::CHANNEL_DELETED;
124
125 // This typedef mainly exists to avoid having to repeat the "NOLINT" incantation
126 // all over the place.
127 typedef MockFunction<void(int)> Checkpoint; // NOLINT
128
119 // This mock is for testing expectations about how the EventInterface is used. 129 // This mock is for testing expectations about how the EventInterface is used.
120 class MockWebSocketEventInterface : public WebSocketEventInterface { 130 class MockWebSocketEventInterface : public WebSocketEventInterface {
121 public: 131 public:
122 MOCK_METHOD2(OnAddChannelResponse, void(bool, const std::string&)); 132 MOCK_METHOD2(OnAddChannelResponse,
133 ChannelState(bool, const std::string&)); // NOLINT
123 MOCK_METHOD3(OnDataFrame, 134 MOCK_METHOD3(OnDataFrame,
124 void(bool, WebSocketMessageType, const std::vector<char>&)); 135 ChannelState(bool,
125 MOCK_METHOD1(OnFlowControl, void(int64)); 136 WebSocketMessageType,
126 MOCK_METHOD0(OnClosingHandshake, void(void)); 137 const std::vector<char>&)); // NOLINT
127 MOCK_METHOD2(OnDropChannel, void(uint16, const std::string&)); 138 MOCK_METHOD1(OnFlowControl, ChannelState(int64)); // NOLINT
139 MOCK_METHOD0(OnClosingHandshake, ChannelState(void)); // NOLINT
140 MOCK_METHOD2(OnDropChannel,
141 ChannelState(uint16, const std::string&)); // NOLINT
128 }; 142 };
129 143
130 // This fake EventInterface is for tests which need a WebSocketEventInterface 144 // This fake EventInterface is for tests which need a WebSocketEventInterface
131 // implementation but are not verifying how it is used. 145 // implementation but are not verifying how it is used.
132 class FakeWebSocketEventInterface : public WebSocketEventInterface { 146 class FakeWebSocketEventInterface : public WebSocketEventInterface {
133 virtual void OnAddChannelResponse( 147 virtual ChannelState OnAddChannelResponse(
134 bool fail, 148 bool fail,
135 const std::string& selected_protocol) OVERRIDE {} 149 const std::string& selected_protocol) OVERRIDE {
136 virtual void OnDataFrame(bool fin, 150 return fail ? CHANNEL_DELETED : CHANNEL_ALIVE;
137 WebSocketMessageType type, 151 }
138 const std::vector<char>& data) OVERRIDE {} 152 virtual ChannelState OnDataFrame(bool fin,
139 virtual void OnFlowControl(int64 quota) OVERRIDE {} 153 WebSocketMessageType type,
140 virtual void OnClosingHandshake() OVERRIDE {} 154 const std::vector<char>& data) OVERRIDE {
141 virtual void OnDropChannel(uint16 code, const std::string& reason) OVERRIDE {} 155 return CHANNEL_ALIVE;
156 }
157 virtual ChannelState OnFlowControl(int64 quota) OVERRIDE {
158 return CHANNEL_ALIVE;
159 }
160 virtual ChannelState OnClosingHandshake() OVERRIDE { return CHANNEL_ALIVE; }
161 virtual ChannelState OnDropChannel(uint16 code,
162 const std::string& reason) OVERRIDE {
163 return CHANNEL_DELETED;
164 }
142 }; 165 };
143 166
144 // This fake WebSocketStream is for tests that require a WebSocketStream but are 167 // This fake WebSocketStream is for tests that require a WebSocketStream but are
145 // not testing the way it is used. It has minimal functionality to return 168 // not testing the way it is used. It has minimal functionality to return
146 // the |protocol| and |extensions| that it was constructed with. 169 // the |protocol| and |extensions| that it was constructed with.
147 class FakeWebSocketStream : public WebSocketStream { 170 class FakeWebSocketStream : public WebSocketStream {
148 public: 171 public:
149 // Constructs with empty protocol and extensions. 172 // Constructs with empty protocol and extensions.
150 FakeWebSocketStream() {} 173 FakeWebSocketStream() {}
151 174
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 CompletionCallback read_callback_; 565 CompletionCallback read_callback_;
543 // Owned by the caller of ReadFrames(). 566 // Owned by the caller of ReadFrames().
544 ScopedVector<WebSocketFrame>* read_frames_; 567 ScopedVector<WebSocketFrame>* read_frames_;
545 // True if we should close the connection. 568 // True if we should close the connection.
546 bool done_; 569 bool done_;
547 }; 570 };
548 571
549 // A FakeWebSocketStream where writes trigger a connection reset. 572 // A FakeWebSocketStream where writes trigger a connection reset.
550 // This differs from UnWriteableFakeWebSocketStream in that it is asynchronous 573 // This differs from UnWriteableFakeWebSocketStream in that it is asynchronous
551 // and triggers ReadFrames to return a reset as well. Tests using this need to 574 // and triggers ReadFrames to return a reset as well. Tests using this need to
552 // run the message loop. 575 // run the message loop. There are two tricky parts here:
576 // 1. Calling the write callback may call Close(), after which the read callback
577 // should not be called.
578 // 2. Calling either callback may delete the stream altogether.
553 class ResetOnWriteFakeWebSocketStream : public FakeWebSocketStream { 579 class ResetOnWriteFakeWebSocketStream : public FakeWebSocketStream {
554 public: 580 public:
581 ResetOnWriteFakeWebSocketStream() : closed_(false), weak_ptr_factory_(this) {}
582
555 virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames, 583 virtual int WriteFrames(ScopedVector<WebSocketFrame>* frames,
556 const CompletionCallback& callback) OVERRIDE { 584 const CompletionCallback& callback) OVERRIDE {
557 base::MessageLoop::current()->PostTask( 585 base::MessageLoop::current()->PostTask(
558 FROM_HERE, base::Bind(callback, ERR_CONNECTION_RESET)); 586 FROM_HERE,
587 base::Bind(&ResetOnWriteFakeWebSocketStream::CallCallbackUnlessClosed,
588 weak_ptr_factory_.GetWeakPtr(),
589 callback,
590 ERR_CONNECTION_RESET));
559 base::MessageLoop::current()->PostTask( 591 base::MessageLoop::current()->PostTask(
560 FROM_HERE, base::Bind(read_callback_, ERR_CONNECTION_RESET)); 592 FROM_HERE,
593 base::Bind(&ResetOnWriteFakeWebSocketStream::CallCallbackUnlessClosed,
594 weak_ptr_factory_.GetWeakPtr(),
595 read_callback_,
596 ERR_CONNECTION_RESET));
561 return ERR_IO_PENDING; 597 return ERR_IO_PENDING;
562 } 598 }
563 599
564 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames, 600 virtual int ReadFrames(ScopedVector<WebSocketFrame>* frames,
565 const CompletionCallback& callback) OVERRIDE { 601 const CompletionCallback& callback) OVERRIDE {
566 read_callback_ = callback; 602 read_callback_ = callback;
567 return ERR_IO_PENDING; 603 return ERR_IO_PENDING;
568 } 604 }
569 605
606 virtual void Close() OVERRIDE { closed_ = true; }
607
570 private: 608 private:
609 void CallCallbackUnlessClosed(const CompletionCallback& callback, int value) {
610 if (!closed_)
611 callback.Run(value);
612 }
613
571 CompletionCallback read_callback_; 614 CompletionCallback read_callback_;
615 bool closed_;
616 // An IO error can result in the socket being deleted, so we use weak pointers
617 // to ensure correct behaviour in that case.
618 base::WeakPtrFactory<ResetOnWriteFakeWebSocketStream> weak_ptr_factory_;
572 }; 619 };
573 620
574 // This mock is for verifying that WebSocket protocol semantics are obeyed (to 621 // This mock is for verifying that WebSocket protocol semantics are obeyed (to
575 // the extent that they are implemented in WebSocketCommon). 622 // the extent that they are implemented in WebSocketCommon).
576 class MockWebSocketStream : public WebSocketStream { 623 class MockWebSocketStream : public WebSocketStream {
577 public: 624 public:
578 MOCK_METHOD2(ReadFrames, 625 MOCK_METHOD2(ReadFrames,
579 int(ScopedVector<WebSocketFrame>* frames, 626 int(ScopedVector<WebSocketFrame>* frames,
580 const CompletionCallback& callback)); 627 const CompletionCallback& callback));
581 MOCK_METHOD2(WriteFrames, 628 MOCK_METHOD2(WriteFrames,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 }; 730 };
684 ConnectData connect_data_; 731 ConnectData connect_data_;
685 732
686 // The channel we are testing. Not initialised until SetChannel() is called. 733 // The channel we are testing. Not initialised until SetChannel() is called.
687 scoped_ptr<WebSocketChannel> channel_; 734 scoped_ptr<WebSocketChannel> channel_;
688 735
689 // A mock or fake stream for tests that need one. 736 // A mock or fake stream for tests that need one.
690 scoped_ptr<WebSocketStream> stream_; 737 scoped_ptr<WebSocketStream> stream_;
691 }; 738 };
692 739
740 // enum of WebSocketEventInterface calls. These are intended to be or'd together
741 // in order to instruct WebSocketChannelDeletingTest when it should fail.
742 enum EventInterfaceCall {
yhirano 2013/10/10 09:22:27 Since the channel will unconditionally be deleted
Adam Rice 2013/10/11 05:42:54 Setting it to zero breaks the (deleting_ & call) c
743 EVENT_NONE = 0x0,
744 EVENT_ON_ADD_CHANNEL_RESPONSE = 0x1,
745 EVENT_ON_DATA_FRAME = 0x2,
746 EVENT_ON_FLOW_CONTROL = 0x4,
747 EVENT_ON_CLOSING_HANDSHAKE = 0x8,
748 EVENT_ON_DROP_CHANNEL = 0x10,
749 };
750
693 class WebSocketChannelDeletingTest : public WebSocketChannelTest { 751 class WebSocketChannelDeletingTest : public WebSocketChannelTest {
694 public: 752 public:
695 void ResetChannel() { channel_.reset(); } 753 ChannelState DeleteIfDeleting(EventInterfaceCall call) {
754 if (deleting_ & call) {
755 channel_.reset();
756 return CHANNEL_DELETED;
757 } else {
758 return CHANNEL_ALIVE;
759 }
760 }
696 761
697 protected: 762 protected:
763 WebSocketChannelDeletingTest()
764 : deleting_(EVENT_ON_ADD_CHANNEL_RESPONSE | EVENT_ON_DATA_FRAME |
765 EVENT_ON_FLOW_CONTROL |
766 EVENT_ON_CLOSING_HANDSHAKE |
767 EVENT_ON_DROP_CHANNEL) {}
698 // Create a ChannelDeletingFakeWebSocketEventInterface. Defined out-of-line to 768 // Create a ChannelDeletingFakeWebSocketEventInterface. Defined out-of-line to
699 // avoid circular dependency. 769 // avoid circular dependency.
700 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE; 770 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE;
771
772 // Tests can set deleting_ to a bitmap of EventInterfaceCall members that they
773 // want to cause Channel deletion. The default is for all calls to cause
774 // deletion.
775 int deleting_;
701 }; 776 };
702 777
703 // A FakeWebSocketEventInterface that deletes the WebSocketChannel on failure to 778 // A FakeWebSocketEventInterface that deletes the WebSocketChannel on failure to
704 // connect. 779 // connect.
705 class ChannelDeletingFakeWebSocketEventInterface 780 class ChannelDeletingFakeWebSocketEventInterface
706 : public FakeWebSocketEventInterface { 781 : public FakeWebSocketEventInterface {
707 public: 782 public:
708 ChannelDeletingFakeWebSocketEventInterface( 783 ChannelDeletingFakeWebSocketEventInterface(
709 WebSocketChannelDeletingTest* fixture) 784 WebSocketChannelDeletingTest* fixture)
710 : fixture_(fixture) {} 785 : fixture_(fixture) {}
711 786
712 virtual void OnAddChannelResponse( 787 virtual ChannelState OnAddChannelResponse(
713 bool fail, 788 bool fail,
714 const std::string& selected_protocol) OVERRIDE { 789 const std::string& selected_protocol) OVERRIDE {
715 if (fail) { 790 return fixture_->DeleteIfDeleting(EVENT_ON_ADD_CHANNEL_RESPONSE);
716 fixture_->ResetChannel(); 791 }
717 } 792
793 virtual ChannelState OnDataFrame(bool fin,
794 WebSocketMessageType type,
795 const std::vector<char>& data) OVERRIDE {
796 return fixture_->DeleteIfDeleting(EVENT_ON_DATA_FRAME);
797 }
798
799 virtual ChannelState OnFlowControl(int64 quota) OVERRIDE {
800 return fixture_->DeleteIfDeleting(EVENT_ON_FLOW_CONTROL);
801 }
802
803 virtual ChannelState OnClosingHandshake() OVERRIDE {
804 return fixture_->DeleteIfDeleting(EVENT_ON_CLOSING_HANDSHAKE);
805 }
806
807 virtual ChannelState OnDropChannel(uint16 code,
808 const std::string& reason) OVERRIDE {
809 return fixture_->DeleteIfDeleting(EVENT_ON_DROP_CHANNEL);
718 } 810 }
719 811
720 private: 812 private:
721 // A pointer to the test fixture. Owned by the test harness; this object will 813 // A pointer to the test fixture. Owned by the test harness; this object will
722 // be deleted before it is. 814 // be deleted before it is.
723 WebSocketChannelDeletingTest* fixture_; 815 WebSocketChannelDeletingTest* fixture_;
724 }; 816 };
725 817
726 scoped_ptr<WebSocketEventInterface> 818 scoped_ptr<WebSocketEventInterface>
727 WebSocketChannelDeletingTest::CreateEventInterface() { 819 WebSocketChannelDeletingTest::CreateEventInterface() {
728 return scoped_ptr<WebSocketEventInterface>( 820 return scoped_ptr<WebSocketEventInterface>(
729 new ChannelDeletingFakeWebSocketEventInterface(this)); 821 new ChannelDeletingFakeWebSocketEventInterface(this));
730 } 822 }
731 823
732 // Base class for tests which verify that EventInterface methods are called 824 // Base class for tests which verify that EventInterface methods are called
733 // appropriately. 825 // appropriately.
734 class WebSocketChannelEventInterfaceTest : public WebSocketChannelTest { 826 class WebSocketChannelEventInterfaceTest : public WebSocketChannelTest {
735 protected: 827 protected:
736 WebSocketChannelEventInterfaceTest() 828 WebSocketChannelEventInterfaceTest()
737 : event_interface_(new StrictMock<MockWebSocketEventInterface>) {} 829 : event_interface_(new StrictMock<MockWebSocketEventInterface>) {
830 DefaultValue<ChannelState>::Set(CHANNEL_ALIVE);
831 ON_CALL(*event_interface_, OnAddChannelResponse(true, _))
832 .WillByDefault(Return(CHANNEL_DELETED));
833 ON_CALL(*event_interface_, OnDropChannel(_, _))
834 .WillByDefault(Return(CHANNEL_DELETED));
835 }
738 836
739 // Tests using this fixture must set expectations on the event_interface_ mock 837 // Tests using this fixture must set expectations on the event_interface_ mock
740 // object before calling CreateChannelAndConnect() or 838 // object before calling CreateChannelAndConnect() or
741 // CreateChannelAndConnectSuccessfully(). This will only work once per test 839 // CreateChannelAndConnectSuccessfully(). This will only work once per test
742 // case, but once should be enough. 840 // case, but once should be enough.
743 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE { 841 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() OVERRIDE {
744 return scoped_ptr<WebSocketEventInterface>(event_interface_.release()); 842 return scoped_ptr<WebSocketEventInterface>(event_interface_.release());
745 } 843 }
746 844
747 scoped_ptr<MockWebSocketEventInterface> event_interface_; 845 scoped_ptr<MockWebSocketEventInterface> event_interface_;
(...skipping 24 matching lines...) Expand all
772 CreateChannelAndConnect(); 870 CreateChannelAndConnect();
773 871
774 EXPECT_EQ(connect_data_.url, connect_data_.factory.socket_url); 872 EXPECT_EQ(connect_data_.url, connect_data_.factory.socket_url);
775 EXPECT_EQ(connect_data_.origin, connect_data_.factory.origin); 873 EXPECT_EQ(connect_data_.origin, connect_data_.factory.origin);
776 EXPECT_EQ(connect_data_.requested_subprotocols, 874 EXPECT_EQ(connect_data_.requested_subprotocols,
777 connect_data_.factory.requested_subprotocols); 875 connect_data_.factory.requested_subprotocols);
778 EXPECT_EQ(&connect_data_.url_request_context, 876 EXPECT_EQ(&connect_data_.url_request_context,
779 connect_data_.factory.url_request_context); 877 connect_data_.factory.url_request_context);
780 } 878 }
781 879
782 // The documentation for WebSocketEventInterface::OnAddChannelResponse() says 880 // Any WebSocketEventInterface methods can delete the WebSocketChannel and
783 // that if the first argument is true, ie. the connection failed, then we can 881 // return CHANNEL_DELETED. The WebSocketChannelDeletingTests are intended to
784 // safely synchronously delete the WebSocketChannel. This test will only 882 // verify that there are no use-after-free bugs when this happens. Probably will
785 // reliably find problems if run with a memory debugger such as 883 // probably only be found when running under ASAN.
786 // AddressSanitizer. 884 TEST_F(WebSocketChannelDeletingTest, OnAddChannelResponseFail) {
787 TEST_F(WebSocketChannelDeletingTest, DeletingFromOnAddChannelResponseWorks) {
788 CreateChannelAndConnect(); 885 CreateChannelAndConnect();
yhirano 2013/10/10 09:22:27 Please state that channel_ is not null after this
Adam Rice 2013/10/11 05:42:54 Done.
789 connect_data_.factory.connect_delegate->OnFailure( 886 connect_data_.factory.connect_delegate->OnFailure(
790 kWebSocketErrorNoStatusReceived); 887 kWebSocketErrorNoStatusReceived);
791 EXPECT_EQ(NULL, channel_.get()); 888 EXPECT_EQ(NULL, channel_.get());
792 } 889 }
793 890
891 // Deletion is possible (due to IPC failure) even if the connect succeeds.
892 TEST_F(WebSocketChannelDeletingTest, OnAddChannelResponseSuccess) {
893 CreateChannelAndConnectSuccessfully();
894 EXPECT_EQ(NULL, channel_.get());
895 }
896
897 TEST_F(WebSocketChannelDeletingTest, OnDataFrameSync) {
898 scoped_ptr<ReadableFakeWebSocketStream> stream(
899 new ReadableFakeWebSocketStream);
900 static const InitFrame frames[] = {
901 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}};
902 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
903 set_stream(stream.Pass());
904 deleting_ = EVENT_ON_DATA_FRAME;
905
906 CreateChannelAndConnectSuccessfully();
907 EXPECT_EQ(NULL, channel_.get());
908 }
909
910 TEST_F(WebSocketChannelDeletingTest, OnDataFrameAsync) {
911 scoped_ptr<ReadableFakeWebSocketStream> stream(
912 new ReadableFakeWebSocketStream);
913 static const InitFrame frames[] = {
914 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}};
915 stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames);
916 set_stream(stream.Pass());
917 deleting_ = EVENT_ON_DATA_FRAME;
918
919 CreateChannelAndConnectSuccessfully();
920 EXPECT_TRUE(channel_);
921 base::MessageLoop::current()->RunUntilIdle();
922 EXPECT_EQ(NULL, channel_.get());
923 }
924
925 TEST_F(WebSocketChannelDeletingTest, OnFlowControlAfterConnect) {
926 deleting_ = EVENT_ON_FLOW_CONTROL;
927
928 CreateChannelAndConnectSuccessfully();
929 EXPECT_EQ(NULL, channel_.get());
930 }
931
932 TEST_F(WebSocketChannelDeletingTest, OnFlowControlAfterSend) {
933 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream));
934 deleting_ = EVENT_NONE;
935 CreateChannelAndConnectSuccessfully();
936 ASSERT_TRUE(channel_);
937 deleting_ = EVENT_ON_FLOW_CONTROL;
938 channel_->SendFrame(true,
939 WebSocketFrameHeader::kOpCodeText,
940 std::vector<char>(kDefaultInitialQuota, 'B'));
941 EXPECT_EQ(NULL, channel_.get());
942 }
943
944 TEST_F(WebSocketChannelDeletingTest, OnClosingHandshakeSync) {
945 scoped_ptr<ReadableFakeWebSocketStream> stream(
946 new ReadableFakeWebSocketStream);
947 static const InitFrame frames[] = {
948 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose,
949 NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Success")}};
950 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
951 set_stream(stream.Pass());
952 deleting_ = EVENT_ON_CLOSING_HANDSHAKE;
953 CreateChannelAndConnectSuccessfully();
954 EXPECT_EQ(NULL, channel_.get());
955 }
956
957 TEST_F(WebSocketChannelDeletingTest, OnClosingHandshakeAsync) {
958 scoped_ptr<ReadableFakeWebSocketStream> stream(
959 new ReadableFakeWebSocketStream);
960 static const InitFrame frames[] = {
961 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose,
962 NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Success")}};
963 stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames);
964 set_stream(stream.Pass());
965 deleting_ = EVENT_ON_CLOSING_HANDSHAKE;
966 CreateChannelAndConnectSuccessfully();
967 ASSERT_TRUE(channel_);
968 base::MessageLoop::current()->RunUntilIdle();
969 EXPECT_EQ(NULL, channel_.get());
970 }
971
972 TEST_F(WebSocketChannelDeletingTest, OnDropChannelWriteError) {
973 set_stream(make_scoped_ptr(new UnWriteableFakeWebSocketStream));
974 deleting_ = EVENT_ON_DROP_CHANNEL;
975 CreateChannelAndConnectSuccessfully();
976 ASSERT_TRUE(channel_);
977 channel_->SendFrame(
978 true, WebSocketFrameHeader::kOpCodeText, AsVector("this will fail"));
979 EXPECT_EQ(NULL, channel_.get());
980 }
981
982 TEST_F(WebSocketChannelDeletingTest, OnDropChannelReadError) {
983 scoped_ptr<ReadableFakeWebSocketStream> stream(
984 new ReadableFakeWebSocketStream);
985 stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC,
986 ERR_FAILED);
987 set_stream(stream.Pass());
988 deleting_ = EVENT_ON_DROP_CHANNEL;
989 CreateChannelAndConnectSuccessfully();
990 ASSERT_TRUE(channel_);
991 base::MessageLoop::current()->RunUntilIdle();
992 EXPECT_EQ(NULL, channel_.get());
993 }
994
995 TEST_F(WebSocketChannelDeletingTest, FailChannelInSendFrame) {
996 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream));
997 deleting_ = EVENT_ON_DROP_CHANNEL;
998 CreateChannelAndConnectSuccessfully();
999 ASSERT_TRUE(channel_);
1000 channel_->SendFrame(true,
1001 WebSocketFrameHeader::kOpCodeText,
1002 std::vector<char>(kDefaultInitialQuota * 2, 'T'));
1003 EXPECT_EQ(NULL, channel_.get());
1004 }
1005
1006 TEST_F(WebSocketChannelDeletingTest, FailChannelInOnReadDone) {
1007 scoped_ptr<ReadableFakeWebSocketStream> stream(
1008 new ReadableFakeWebSocketStream);
1009 stream->PrepareReadFramesError(ReadableFakeWebSocketStream::ASYNC,
1010 ERR_WS_PROTOCOL_ERROR);
1011 set_stream(stream.Pass());
1012 deleting_ = EVENT_ON_DROP_CHANNEL;
1013 CreateChannelAndConnectSuccessfully();
1014 ASSERT_TRUE(channel_);
1015 base::MessageLoop::current()->RunUntilIdle();
1016 EXPECT_EQ(NULL, channel_.get());
1017 }
1018
1019 TEST_F(WebSocketChannelDeletingTest, FailChannelDueToMaskedFrame) {
1020 scoped_ptr<ReadableFakeWebSocketStream> stream(
1021 new ReadableFakeWebSocketStream);
1022 static const InitFrame frames[] = {
1023 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "HELLO"}};
1024 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
1025 set_stream(stream.Pass());
1026 deleting_ = EVENT_ON_DROP_CHANNEL;
1027
1028 CreateChannelAndConnectSuccessfully();
1029 EXPECT_EQ(NULL, channel_.get());
1030 }
1031
1032 TEST_F(WebSocketChannelDeletingTest, FailChannelDueToBadControlFrame) {
1033 scoped_ptr<ReadableFakeWebSocketStream> stream(
1034 new ReadableFakeWebSocketStream);
1035 static const InitFrame frames[] = {
1036 {NOT_FINAL_FRAME, WebSocketFrameHeader::kOpCodePong, NOT_MASKED, ""}};
1037 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
1038 set_stream(stream.Pass());
1039 deleting_ = EVENT_ON_DROP_CHANNEL;
1040
1041 CreateChannelAndConnectSuccessfully();
1042 EXPECT_EQ(NULL, channel_.get());
1043 }
1044
1045 TEST_F(WebSocketChannelDeletingTest, FailChannelDueToPongAfterClose) {
1046 scoped_ptr<ReadableFakeWebSocketStream> stream(
1047 new ReadableFakeWebSocketStream);
1048 static const InitFrame frames[] = {
1049 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED,
1050 CLOSE_DATA(NORMAL_CLOSURE, "Success")},
1051 {FINAL_FRAME, WebSocketFrameHeader::kOpCodePong, NOT_MASKED, ""}};
1052 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
1053 set_stream(stream.Pass());
1054 deleting_ = EVENT_ON_DROP_CHANNEL;
1055
1056 CreateChannelAndConnectSuccessfully();
1057 EXPECT_EQ(NULL, channel_.get());
1058 }
1059
1060 TEST_F(WebSocketChannelDeletingTest, FailChannelDueToUnknownOpCode) {
1061 scoped_ptr<ReadableFakeWebSocketStream> stream(
1062 new ReadableFakeWebSocketStream);
1063 static const InitFrame frames[] = {{FINAL_FRAME, 0x7, NOT_MASKED, ""}};
1064 stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
1065 set_stream(stream.Pass());
1066 deleting_ = EVENT_ON_DROP_CHANNEL;
1067
1068 CreateChannelAndConnectSuccessfully();
1069 EXPECT_EQ(NULL, channel_.get());
1070 }
1071
794 TEST_F(WebSocketChannelEventInterfaceTest, ConnectSuccessReported) { 1072 TEST_F(WebSocketChannelEventInterfaceTest, ConnectSuccessReported) {
795 // false means success. 1073 // false means success.
796 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, "")); 1074 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, ""));
797 // OnFlowControl is always called immediately after connect to provide initial 1075 // OnFlowControl is always called immediately after connect to provide initial
798 // quota to the renderer. 1076 // quota to the renderer.
799 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1077 EXPECT_CALL(*event_interface_, OnFlowControl(_));
800 1078
801 CreateChannelAndConnect(); 1079 CreateChannelAndConnect();
802 1080
803 connect_data_.factory.connect_delegate->OnSuccess(stream_.Pass()); 1081 connect_data_.factory.connect_delegate->OnSuccess(stream_.Pass());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 CreateChannelAndConnectSuccessfully(); 1168 CreateChannelAndConnectSuccessfully();
891 } 1169 }
892 1170
893 TEST_F(WebSocketChannelEventInterfaceTest, NormalAsyncRead) { 1171 TEST_F(WebSocketChannelEventInterfaceTest, NormalAsyncRead) {
894 scoped_ptr<ReadableFakeWebSocketStream> stream( 1172 scoped_ptr<ReadableFakeWebSocketStream> stream(
895 new ReadableFakeWebSocketStream); 1173 new ReadableFakeWebSocketStream);
896 static const InitFrame frames[] = { 1174 static const InitFrame frames[] = {
897 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}}; 1175 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED, "HELLO"}};
898 // We use this checkpoint object to verify that the callback isn't called 1176 // We use this checkpoint object to verify that the callback isn't called
899 // until we expect it to be. 1177 // until we expect it to be.
900 MockFunction<void(int)> checkpoint; 1178 Checkpoint checkpoint; // NOLINT
yhirano 2013/10/10 09:22:27 NOLINT is needless.
Adam Rice 2013/10/11 05:42:54 Oh yeah. Removed.
901 stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames); 1179 stream->PrepareReadFrames(ReadableFakeWebSocketStream::ASYNC, OK, frames);
902 set_stream(stream.Pass()); 1180 set_stream(stream.Pass());
903 { 1181 {
904 InSequence s; 1182 InSequence s;
905 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _)); 1183 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _));
906 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1184 EXPECT_CALL(*event_interface_, OnFlowControl(_));
907 EXPECT_CALL(checkpoint, Call(1)); 1185 EXPECT_CALL(checkpoint, Call(1));
908 EXPECT_CALL( 1186 EXPECT_CALL(
909 *event_interface_, 1187 *event_interface_,
910 OnDataFrame( 1188 OnDataFrame(
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 CreateChannelAndConnectSuccessfully(); 1456 CreateChannelAndConnectSuccessfully();
1179 channel_->SendFrame(true, WebSocketFrameHeader::kOpCodeText, AsVector("B")); 1457 channel_->SendFrame(true, WebSocketFrameHeader::kOpCodeText, AsVector("B"));
1180 } 1458 }
1181 1459
1182 // If we send enough to go below send_quota_low_water_mask_ we should get our 1460 // If we send enough to go below send_quota_low_water_mask_ we should get our
1183 // quota refreshed. 1461 // quota refreshed.
1184 TEST_F(WebSocketChannelEventInterfaceTest, LargeWriteUpdatesQuota) { 1462 TEST_F(WebSocketChannelEventInterfaceTest, LargeWriteUpdatesQuota) {
1185 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream)); 1463 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream));
1186 // We use this checkpoint object to verify that the quota update comes after 1464 // We use this checkpoint object to verify that the quota update comes after
1187 // the write. 1465 // the write.
1188 MockFunction<void(int)> checkpoint; 1466 Checkpoint checkpoint;
1189 { 1467 {
1190 InSequence s; 1468 InSequence s;
1191 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _)); 1469 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _));
1192 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1470 EXPECT_CALL(*event_interface_, OnFlowControl(_));
1193 EXPECT_CALL(checkpoint, Call(1)); 1471 EXPECT_CALL(checkpoint, Call(1));
1194 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1472 EXPECT_CALL(*event_interface_, OnFlowControl(_));
1195 EXPECT_CALL(checkpoint, Call(2)); 1473 EXPECT_CALL(checkpoint, Call(2));
1196 } 1474 }
1197 1475
1198 CreateChannelAndConnectSuccessfully(); 1476 CreateChannelAndConnectSuccessfully();
1199 checkpoint.Call(1); 1477 checkpoint.Call(1);
1200 channel_->SendFrame(true, 1478 channel_->SendFrame(true,
1201 WebSocketFrameHeader::kOpCodeText, 1479 WebSocketFrameHeader::kOpCodeText,
1202 std::vector<char>(kDefaultInitialQuota, 'B')); 1480 std::vector<char>(kDefaultInitialQuota, 'B'));
1203 checkpoint.Call(2); 1481 checkpoint.Call(2);
1204 } 1482 }
1205 1483
1206 // Verify that our quota actually is refreshed when we are told it is. 1484 // Verify that our quota actually is refreshed when we are told it is.
1207 TEST_F(WebSocketChannelEventInterfaceTest, QuotaReallyIsRefreshed) { 1485 TEST_F(WebSocketChannelEventInterfaceTest, QuotaReallyIsRefreshed) {
1208 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream)); 1486 set_stream(make_scoped_ptr(new WriteableFakeWebSocketStream));
1209 MockFunction<void(int)> checkpoint; 1487 Checkpoint checkpoint;
1210 { 1488 {
1211 InSequence s; 1489 InSequence s;
1212 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _)); 1490 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _));
1213 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1491 EXPECT_CALL(*event_interface_, OnFlowControl(_));
1214 EXPECT_CALL(checkpoint, Call(1)); 1492 EXPECT_CALL(checkpoint, Call(1));
1215 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1493 EXPECT_CALL(*event_interface_, OnFlowControl(_));
1216 EXPECT_CALL(checkpoint, Call(2)); 1494 EXPECT_CALL(checkpoint, Call(2));
1217 // If quota was not really refreshed, we would get an OnDropChannel() 1495 // If quota was not really refreshed, we would get an OnDropChannel()
1218 // message. 1496 // message.
1219 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1497 EXPECT_CALL(*event_interface_, OnFlowControl(_));
(...skipping 27 matching lines...) Expand all
1247 1525
1248 CreateChannelAndConnectSuccessfully(); 1526 CreateChannelAndConnectSuccessfully();
1249 channel_->SendFrame(true, 1527 channel_->SendFrame(true,
1250 WebSocketFrameHeader::kOpCodeText, 1528 WebSocketFrameHeader::kOpCodeText,
1251 std::vector<char>(kDefaultInitialQuota + 1, 'C')); 1529 std::vector<char>(kDefaultInitialQuota + 1, 'C'));
1252 } 1530 }
1253 1531
1254 // If a write fails, the channel is dropped. 1532 // If a write fails, the channel is dropped.
1255 TEST_F(WebSocketChannelEventInterfaceTest, FailedWrite) { 1533 TEST_F(WebSocketChannelEventInterfaceTest, FailedWrite) {
1256 set_stream(make_scoped_ptr(new UnWriteableFakeWebSocketStream)); 1534 set_stream(make_scoped_ptr(new UnWriteableFakeWebSocketStream));
1257 MockFunction<void(int)> checkpoint; 1535 Checkpoint checkpoint;
1258 { 1536 {
1259 InSequence s; 1537 InSequence s;
1260 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _)); 1538 EXPECT_CALL(*event_interface_, OnAddChannelResponse(false, _));
1261 EXPECT_CALL(*event_interface_, OnFlowControl(_)); 1539 EXPECT_CALL(*event_interface_, OnFlowControl(_));
1262 EXPECT_CALL(checkpoint, Call(1)); 1540 EXPECT_CALL(checkpoint, Call(1));
1263 EXPECT_CALL(*event_interface_, 1541 EXPECT_CALL(*event_interface_,
1264 OnDropChannel(kWebSocketErrorAbnormalClosure, _)); 1542 OnDropChannel(kWebSocketErrorAbnormalClosure, _));
1265 EXPECT_CALL(checkpoint, Call(2)); 1543 EXPECT_CALL(checkpoint, Call(2));
1266 } 1544 }
1267 1545
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 static const InitFrame frames_init[] = { 1700 static const InitFrame frames_init[] = {
1423 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, 1701 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose,
1424 NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Close")}}; 1702 NOT_MASKED, CLOSE_DATA(NORMAL_CLOSURE, "Close")}};
1425 1703
1426 // We store the parameters that were passed to ReadFrames() so that we can 1704 // We store the parameters that were passed to ReadFrames() so that we can
1427 // call them explicitly later. 1705 // call them explicitly later.
1428 CompletionCallback read_callback; 1706 CompletionCallback read_callback;
1429 ScopedVector<WebSocketFrame>* frames = NULL; 1707 ScopedVector<WebSocketFrame>* frames = NULL;
1430 1708
1431 // Use a checkpoint to make the ordering of events clearer. 1709 // Use a checkpoint to make the ordering of events clearer.
1432 MockFunction<void(int)> checkpoint; 1710 Checkpoint checkpoint;
1433 { 1711 {
1434 InSequence s; 1712 InSequence s;
1435 EXPECT_CALL(*mock_stream_, GetSubProtocol()).Times(AnyNumber()); 1713 EXPECT_CALL(*mock_stream_, GetSubProtocol()).Times(AnyNumber());
1436 EXPECT_CALL(*mock_stream_, ReadFrames(_, _)) 1714 EXPECT_CALL(*mock_stream_, ReadFrames(_, _))
1437 .WillOnce(DoAll(SaveArg<0>(&frames), 1715 .WillOnce(DoAll(SaveArg<0>(&frames),
1438 SaveArg<1>(&read_callback), 1716 SaveArg<1>(&read_callback),
1439 Return(ERR_IO_PENDING))); 1717 Return(ERR_IO_PENDING)));
1440 EXPECT_CALL(checkpoint, Call(1)); 1718 EXPECT_CALL(checkpoint, Call(1));
1441 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected), _)) 1719 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected), _))
1442 .WillOnce(Return(OK)); 1720 .WillOnce(Return(OK));
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 } 1819 }
1542 1820
1543 // WriteFrames() may not be called until the previous write has completed. 1821 // WriteFrames() may not be called until the previous write has completed.
1544 // WebSocketChannel must buffer writes that happen in the meantime. 1822 // WebSocketChannel must buffer writes that happen in the meantime.
1545 TEST_F(WebSocketChannelStreamTest, WriteFramesOneAtATime) { 1823 TEST_F(WebSocketChannelStreamTest, WriteFramesOneAtATime) {
1546 static const InitFrame expected1[] = { 1824 static const InitFrame expected1[] = {
1547 {NOT_FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "Hello "}}; 1825 {NOT_FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "Hello "}};
1548 static const InitFrame expected2[] = { 1826 static const InitFrame expected2[] = {
1549 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "World"}}; 1827 {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, MASKED, "World"}};
1550 CompletionCallback write_callback; 1828 CompletionCallback write_callback;
1551 MockFunction<void(int)> checkpoint; 1829 Checkpoint checkpoint;
1552 1830
1553 EXPECT_CALL(*mock_stream_, GetSubProtocol()).Times(AnyNumber()); 1831 EXPECT_CALL(*mock_stream_, GetSubProtocol()).Times(AnyNumber());
1554 EXPECT_CALL(*mock_stream_, ReadFrames(_, _)).WillOnce(Return(ERR_IO_PENDING)); 1832 EXPECT_CALL(*mock_stream_, ReadFrames(_, _)).WillOnce(Return(ERR_IO_PENDING));
1555 { 1833 {
1556 InSequence s; 1834 InSequence s;
1557 EXPECT_CALL(checkpoint, Call(1)); 1835 EXPECT_CALL(checkpoint, Call(1));
1558 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected1), _)) 1836 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected1), _))
1559 .WillOnce(DoAll(SaveArg<1>(&write_callback), Return(ERR_IO_PENDING))); 1837 .WillOnce(DoAll(SaveArg<1>(&write_callback), Return(ERR_IO_PENDING)));
1560 EXPECT_CALL(checkpoint, Call(2)); 1838 EXPECT_CALL(checkpoint, Call(2));
1561 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected2), _)) 1839 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected2), _))
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 .WillOnce(Return(ERR_WS_PROTOCOL_ERROR)); 2000 .WillOnce(Return(ERR_WS_PROTOCOL_ERROR));
1723 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected), _)) 2001 EXPECT_CALL(*mock_stream_, WriteFrames(EqualsFrames(expected), _))
1724 .WillOnce(Return(OK)); 2002 .WillOnce(Return(OK));
1725 EXPECT_CALL(*mock_stream_, Close()); 2003 EXPECT_CALL(*mock_stream_, Close());
1726 2004
1727 CreateChannelAndConnectSuccessfully(); 2005 CreateChannelAndConnectSuccessfully();
1728 } 2006 }
1729 2007
1730 } // namespace 2008 } // namespace
1731 } // namespace net 2009 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698