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

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

Issue 657013003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 <limits.h> 7 #include <limits.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <iostream> 10 #include <iostream>
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 // mock instead. 773 // mock instead.
774 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() { 774 virtual scoped_ptr<WebSocketEventInterface> CreateEventInterface() {
775 return scoped_ptr<WebSocketEventInterface>(new FakeWebSocketEventInterface); 775 return scoped_ptr<WebSocketEventInterface>(new FakeWebSocketEventInterface);
776 } 776 }
777 777
778 // This method serves no other purpose than to provide a nice syntax for 778 // This method serves no other purpose than to provide a nice syntax for
779 // assigning to stream_. class T must be a subclass of WebSocketStream or you 779 // assigning to stream_. class T must be a subclass of WebSocketStream or you
780 // will have unpleasant compile errors. 780 // will have unpleasant compile errors.
781 template <class T> 781 template <class T>
782 void set_stream(scoped_ptr<T> stream) { 782 void set_stream(scoped_ptr<T> stream) {
783 // Since the definition of "PassAs" depends on the type T, the C++ standard 783 stream_ = stream.Pass();
784 // requires the "template" keyword to indicate that "PassAs" should be
785 // parsed as a template method.
786 stream_ = stream.template PassAs<WebSocketStream>();
787 } 784 }
788 785
789 // A struct containing the data that will be used to connect the channel. 786 // A struct containing the data that will be used to connect the channel.
790 // Grouped for readability. 787 // Grouped for readability.
791 struct ConnectData { 788 struct ConnectData {
792 ConnectData() : socket_url("ws://ws/"), origin("http://ws") {} 789 ConnectData() : socket_url("ws://ws/"), origin("http://ws") {}
793 790
794 // URLRequestContext object. 791 // URLRequestContext object.
795 URLRequestContext url_request_context; 792 URLRequestContext url_request_context;
796 793
(...skipping 2631 matching lines...) Expand 10 before | Expand all | Expand 10 after
3428 channel_->StartClosingHandshake(kWebSocketNormalClosure, "OK"); 3425 channel_->StartClosingHandshake(kWebSocketNormalClosure, "OK");
3429 ASSERT_TRUE(read_frames); 3426 ASSERT_TRUE(read_frames);
3430 // Provide the "Close" message from the server. 3427 // Provide the "Close" message from the server.
3431 *read_frames = CreateFrameVector(frames); 3428 *read_frames = CreateFrameVector(frames);
3432 read_callback.Run(OK); 3429 read_callback.Run(OK);
3433 completion.WaitForResult(); 3430 completion.WaitForResult();
3434 } 3431 }
3435 3432
3436 } // namespace 3433 } // namespace
3437 } // namespace net 3434 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/embedded_test_server_unittest.cc ('k') | net/websockets/websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698