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

Unified Diff: ppapi/tests/test_net_address_private_untrusted.cc

Issue 9307115: PPB_NetAddress_Private: add getter methods for sockaddr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 10 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 | « ppapi/tests/test_net_address_private_untrusted.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_net_address_private_untrusted.cc
diff --git a/ppapi/tests/test_net_address_private_untrusted.cc b/ppapi/tests/test_net_address_private_untrusted.cc
index 08c2410ce86541835d979a625bbac4571f068d28..d8e0996127aa4800563d5137d12c2729d576835a 100644
--- a/ppapi/tests/test_net_address_private_untrusted.cc
+++ b/ppapi/tests/test_net_address_private_untrusted.cc
@@ -47,6 +47,9 @@ void TestNetAddressPrivateUntrusted::RunTests(const std::string& filter) {
RUN_TEST(Describe, filter);
RUN_TEST(ReplacePort, filter);
RUN_TEST(GetAnyAddress, filter);
+ RUN_TEST(GetFamily, filter);
+ RUN_TEST(GetPort, filter);
+ RUN_TEST(GetAddress, filter);
}
int32_t TestNetAddressPrivateUntrusted::Connect(TCPSocketPrivate* socket,
@@ -151,3 +154,52 @@ std::string TestNetAddressPrivateUntrusted::TestGetAnyAddress() {
PASS();
}
+
+std::string TestNetAddressPrivateUntrusted::TestGetFamily() {
+ pp::TCPSocketPrivate socket(instance_);
+ int32_t rv = Connect(&socket, host_, port_);
+ if (rv != PP_OK)
+ return ReportError("pp::TCPSocketPrivate::Connect", rv);
+
+ PP_NetAddress_Private remote_address;
+ ASSERT_TRUE(socket.GetRemoteAddress(&remote_address));
+
+ ASSERT_EQ(NetAddressPrivate::GetFamily(remote_address),
+ NetAddressPrivate::GetFamily(remote_address));
+
+ socket.Disconnect();
+ PASS();
+}
+
+std::string TestNetAddressPrivateUntrusted::TestGetPort() {
+ pp::TCPSocketPrivate socket(instance_);
+ int32_t rv = Connect(&socket, host_, port_);
+ if (rv != PP_OK)
+ return ReportError("pp::TCPSocketPrivate::Connect", rv);
+
+ PP_NetAddress_Private remote_address;
+ ASSERT_TRUE(socket.GetRemoteAddress(&remote_address));
+
+ ASSERT_EQ(NetAddressPrivate::GetPort(remote_address), port_);
+
+ socket.Disconnect();
+ PASS();
+}
+
+std::string TestNetAddressPrivateUntrusted::TestGetAddress() {
+ pp::TCPSocketPrivate socket(instance_);
+ int32_t rv = Connect(&socket, host_, port_);
+ if (rv != PP_OK)
+ return ReportError("pp::TCPSocketPrivate::Connect", rv);
+
+ PP_NetAddress_Private remote_address;
+ ASSERT_TRUE(socket.GetRemoteAddress(&remote_address));
+
+ static const uint16_t buffer_size = sizeof(remote_address.data);
+ char buffer[buffer_size];
+ ASSERT_TRUE(NetAddressPrivate::GetAddress(remote_address, buffer,
+ buffer_size));
+
+ socket.Disconnect();
+ PASS();
+}
« no previous file with comments | « ppapi/tests/test_net_address_private_untrusted.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698