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

Unified Diff: net/websockets/websocket_channel_test.cc

Issue 170843007: Introduce url::Origin to represent Web Origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket_channel.cc ('k') | net/websockets/websocket_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_channel_test.cc
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc
index 222a01641c71ce7a47a27277c9658bd6353f6a00..23fc542c0096ff18a0342a021b5426026bd419f1 100644
--- a/net/websockets/websocket_channel_test.cc
+++ b/net/websockets/websocket_channel_test.cc
@@ -31,6 +31,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+#include "url/origin.h"
// Hacky macros to construct the body of a Close message from a code and a
// string, while ensuring the result is a compile-time constant string.
@@ -680,7 +681,7 @@ struct ArgumentCopyingWebSocketStreamCreator {
scoped_ptr<WebSocketStreamRequest> Create(
const GURL& socket_url,
const std::vector<std::string>& requested_subprotocols,
- const GURL& origin,
+ const url::Origin& origin,
URLRequestContext* url_request_context,
const BoundNetLog& net_log,
scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate) {
@@ -694,7 +695,7 @@ struct ArgumentCopyingWebSocketStreamCreator {
}
GURL socket_url;
- GURL origin;
+ url::Origin origin;
std::vector<std::string> requested_subprotocols;
URLRequestContext* url_request_context;
BoundNetLog net_log;
@@ -754,7 +755,7 @@ class WebSocketChannelTest : public ::testing::Test {
// A struct containing the data that will be used to connect the channel.
// Grouped for readability.
struct ConnectData {
- ConnectData() : socket_url("ws://ws/"), origin("http://ws/") {}
+ ConnectData() : socket_url("ws://ws/"), origin("http://ws") {}
// URLRequestContext object.
URLRequestContext url_request_context;
@@ -764,7 +765,7 @@ class WebSocketChannelTest : public ::testing::Test {
// Requested protocols for the request.
std::vector<std::string> requested_subprotocols;
// Origin of the request
- GURL origin;
+ url::Origin origin;
// A fake WebSocketStreamCreator that just records its arguments.
ArgumentCopyingWebSocketStreamCreator creator;
@@ -959,7 +960,7 @@ class WebSocketChannelReceiveUtf8Test : public WebSocketChannelStreamTest {
// passed to the creator function.
TEST_F(WebSocketChannelTest, EverythingIsPassedToTheCreatorFunction) {
connect_data_.socket_url = GURL("ws://example.com/test");
- connect_data_.origin = GURL("http://example.com/test");
+ connect_data_.origin = url::Origin("http://example.com");
connect_data_.requested_subprotocols.push_back("Sinbad");
CreateChannelAndConnect();
@@ -971,7 +972,7 @@ TEST_F(WebSocketChannelTest, EverythingIsPassedToTheCreatorFunction) {
EXPECT_EQ(connect_data_.socket_url, actual.socket_url);
EXPECT_EQ(connect_data_.requested_subprotocols,
actual.requested_subprotocols);
- EXPECT_EQ(connect_data_.origin, actual.origin);
+ EXPECT_EQ(connect_data_.origin.string(), actual.origin.string());
}
// Verify that calling SendFlowControl before the connection is established does
« no previous file with comments | « net/websockets/websocket_channel.cc ('k') | net/websockets/websocket_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698