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

Unified Diff: chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc

Issue 255443002: Implement argument validation for chrome.cast.channel.{open,send} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extraneous code Created 6 years, 5 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
Index: chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc
diff --git a/chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc b/chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc
index 631e2998e9f5025d32dd59517ed64db0c7f9bdf8..a2c26c2c39ca25ab44038d08fdbba6118c9ad8c3 100644
--- a/chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc
+++ b/chrome/browser/extensions/api/cast_channel/cast_channel_api_unittest.cc
@@ -10,25 +10,23 @@
#include "url/gurl.h"
namespace extensions {
imcheng 2014/07/15 21:26:41 nit: Can this file be reverted?
mark a. foltz 2014/07/16 21:43:26 Done.
-namespace api {
-namespace cast_channel {
// Tests URL parsing and validation.
TEST(CastChannelOpenFunctionTest, TestParseChannelUrl) {
typedef CastChannelOpenFunction ccof;
- ConnectInfo connect_info;
+ cast_channel::ConnectInfo connect_info;
EXPECT_TRUE(ccof::ParseChannelUrl(GURL("cast://192.0.0.1:8009"),
&connect_info));
EXPECT_EQ(connect_info.ip_address, "192.0.0.1");
EXPECT_EQ(connect_info.port, 8009);
- EXPECT_EQ(connect_info.auth, CHANNEL_AUTH_TYPE_SSL);
+ EXPECT_EQ(connect_info.auth, cast_channel::CHANNEL_AUTH_TYPE_SSL);
EXPECT_TRUE(ccof::ParseChannelUrl(GURL("casts://192.0.0.1:12345"),
&connect_info));
EXPECT_EQ(connect_info.ip_address, "192.0.0.1");
EXPECT_EQ(connect_info.port, 12345);
- EXPECT_EQ(connect_info.auth, CHANNEL_AUTH_TYPE_SSL_VERIFIED);
+ EXPECT_EQ(connect_info.auth, cast_channel::CHANNEL_AUTH_TYPE_SSL_VERIFIED);
EXPECT_FALSE(ccof::ParseChannelUrl(GURL("http://192.0.0.1:12345"),
&connect_info));
@@ -52,40 +50,38 @@ TEST(CastChannelOpenFunctionTest, TestParseConnectInfo) {
scoped_ptr<net::IPEndPoint> ip_endpoint;
// Valid ConnectInfo
- ConnectInfo connect_info;
+ cast_channel::ConnectInfo connect_info;
connect_info.ip_address = "192.0.0.1";
connect_info.port = 8009;
- connect_info.auth = CHANNEL_AUTH_TYPE_SSL;
+ connect_info.auth = cast_channel::CHANNEL_AUTH_TYPE_SSL;
ip_endpoint.reset(ccof::ParseConnectInfo(connect_info));
EXPECT_TRUE(ip_endpoint.get() != NULL);
EXPECT_EQ(ip_endpoint->ToString(), "192.0.0.1:8009");
// Invalid IP
- ConnectInfo invalid_ip_connect_info;
+ cast_channel::ConnectInfo invalid_ip_connect_info;
invalid_ip_connect_info.ip_address = "blargh";
invalid_ip_connect_info.port = 8009;
- invalid_ip_connect_info.auth = CHANNEL_AUTH_TYPE_SSL;
+ invalid_ip_connect_info.auth = cast_channel::CHANNEL_AUTH_TYPE_SSL;
ip_endpoint.reset(ccof::ParseConnectInfo(invalid_ip_connect_info));
EXPECT_TRUE(ip_endpoint.get() == NULL);
// Invalid port
- ConnectInfo invalid_port_connect_info;
+ cast_channel::ConnectInfo invalid_port_connect_info;
invalid_port_connect_info.ip_address = "192.0.0.1";
invalid_port_connect_info.port = -1;
- invalid_port_connect_info.auth = CHANNEL_AUTH_TYPE_SSL;
+ invalid_port_connect_info.auth = cast_channel::CHANNEL_AUTH_TYPE_SSL;
ip_endpoint.reset(ccof::ParseConnectInfo(invalid_port_connect_info));
EXPECT_TRUE(ip_endpoint.get() == NULL);
// Invalid auth
- ConnectInfo invalid_auth_connect_info;
+ cast_channel::ConnectInfo invalid_auth_connect_info;
invalid_auth_connect_info.ip_address = "192.0.0.1";
invalid_auth_connect_info.port = 8009;
- invalid_auth_connect_info.auth = CHANNEL_AUTH_TYPE_NONE;
+ invalid_auth_connect_info.auth = cast_channel::CHANNEL_AUTH_TYPE_NONE;
ip_endpoint.reset(ccof::ParseConnectInfo(invalid_auth_connect_info));
EXPECT_TRUE(ip_endpoint.get() == NULL);
}
-} // namespace cast_channel
-} // namespace api
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698