diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 02:38:32 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 02:38:32 +0000 |
commit | 000648e9b9a0be51801901c56e30e58a9efc35d7 (patch) | |
tree | c18bed9bafbb6866a90d9a030fa6137f2b8d76c2 | |
parent | f3855ee19e1260ed81a2743abdd60d317760c66f (diff) | |
download | chromium_src-000648e9b9a0be51801901c56e30e58a9efc35d7.zip chromium_src-000648e9b9a0be51801901c56e30e58a9efc35d7.tar.gz chromium_src-000648e9b9a0be51801901c56e30e58a9efc35d7.tar.bz2 |
Change pp::NetAddress_Dev to use bool instead of PP_Bool.
BUG=247225
TEST=None
Review URL: https://chromiumcodereview.appspot.com/17332003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206885 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ppapi/cpp/dev/net_address_dev.cc | 23 | ||||
-rw-r--r-- | ppapi/cpp/dev/net_address_dev.h | 6 | ||||
-rw-r--r-- | ppapi/tests/test_net_address.cc | 12 |
3 files changed, 22 insertions, 19 deletions
diff --git a/ppapi/cpp/dev/net_address_dev.cc b/ppapi/cpp/dev/net_address_dev.cc index 7f33193..ec09caaa 100644 --- a/ppapi/cpp/dev/net_address_dev.cc +++ b/ppapi/cpp/dev/net_address_dev.cc @@ -4,6 +4,7 @@ #include "ppapi/cpp/dev/net_address_dev.h" +#include "ppapi/c/pp_bool.h" #include "ppapi/cpp/instance_handle.h" #include "ppapi/cpp/module_impl.h" @@ -65,34 +66,36 @@ PP_NetAddress_Family_Dev NetAddress_Dev::GetFamily() const { return PP_NETADDRESS_FAMILY_UNSPECIFIED; } -Var NetAddress_Dev::DescribeAsString(PP_Bool include_port) const { +Var NetAddress_Dev::DescribeAsString(bool include_port) const { if (has_interface<PPB_NetAddress_Dev_0_1>()) { return Var(PASS_REF, get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsString( - pp_resource(), include_port)); + pp_resource(), PP_FromBool(include_port))); } return Var(); } -PP_Bool NetAddress_Dev::DescribeAsIPv4Address( +bool NetAddress_Dev::DescribeAsIPv4Address( PP_NetAddress_IPv4_Dev* ipv4_addr) const { if (has_interface<PPB_NetAddress_Dev_0_1>()) { - return get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv4Address( - pp_resource(), ipv4_addr); + return PP_ToBool( + get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv4Address( + pp_resource(), ipv4_addr)); } - return PP_FALSE; + return false; } -PP_Bool NetAddress_Dev::DescribeAsIPv6Address( +bool NetAddress_Dev::DescribeAsIPv6Address( PP_NetAddress_IPv6_Dev* ipv6_addr) const { if (has_interface<PPB_NetAddress_Dev_0_1>()) { - return get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv6Address( - pp_resource(), ipv6_addr); + return PP_ToBool( + get_interface<PPB_NetAddress_Dev_0_1>()->DescribeAsIPv6Address( + pp_resource(), ipv6_addr)); } - return PP_FALSE; + return false; } } // namespace pp diff --git a/ppapi/cpp/dev/net_address_dev.h b/ppapi/cpp/dev/net_address_dev.h index 2abe14a..e703980 100644 --- a/ppapi/cpp/dev/net_address_dev.h +++ b/ppapi/cpp/dev/net_address_dev.h @@ -40,11 +40,11 @@ class NetAddress_Dev : public Resource { PP_NetAddress_Family_Dev GetFamily() const; - Var DescribeAsString(PP_Bool include_port) const; + Var DescribeAsString(bool include_port) const; - PP_Bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const; + bool DescribeAsIPv4Address(PP_NetAddress_IPv4_Dev* ipv4_addr) const; - PP_Bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const; + bool DescribeAsIPv6Address(PP_NetAddress_IPv6_Dev* ipv6_addr) const; }; } // namespace pp diff --git a/ppapi/tests/test_net_address.cc b/ppapi/tests/test_net_address.cc index 3a31c0d..b6dff7b 100644 --- a/ppapi/tests/test_net_address.cc +++ b/ppapi/tests/test_net_address.cc @@ -102,14 +102,14 @@ std::string TestNetAddress::TestDescribeAsString() { PP_NetAddress_IPv4_Dev ipv4_addr1 = { ConvertToNetEndian16(1234), { 127, 0, 0, 1 } }; NetAddress_Dev addr1(instance_, ipv4_addr1); - ASSERT_EQ("127.0.0.1", addr1.DescribeAsString(PP_FALSE).AsString()); - ASSERT_EQ("127.0.0.1:1234", addr1.DescribeAsString(PP_TRUE).AsString()); + ASSERT_EQ("127.0.0.1", addr1.DescribeAsString(false).AsString()); + ASSERT_EQ("127.0.0.1:1234", addr1.DescribeAsString(true).AsString()); PP_NetAddress_IPv4_Dev ipv4_addr2 = { ConvertToNetEndian16(80), { 192, 168, 0, 2 } }; NetAddress_Dev addr2(instance_, ipv4_addr2); - ASSERT_EQ("192.168.0.2", addr2.DescribeAsString(PP_FALSE).AsString()); - ASSERT_EQ("192.168.0.2:80", addr2.DescribeAsString(PP_TRUE).AsString()); + ASSERT_EQ("192.168.0.2", addr2.DescribeAsString(false).AsString()); + ASSERT_EQ("192.168.0.2:80", addr2.DescribeAsString(true).AsString()); } { // Test describing IPv6 addresses. @@ -164,9 +164,9 @@ std::string TestNetAddress::TestDescribeAsString() { instance_, ipv6_test_cases[i].host_order_addr, ipv6_test_cases[i].host_order_port); ASSERT_EQ(ipv6_test_cases[i].expected_without_port, - addr.DescribeAsString(PP_FALSE).AsString()); + addr.DescribeAsString(false).AsString()); ASSERT_EQ(ipv6_test_cases[i].expected_with_port, - addr.DescribeAsString(PP_TRUE).AsString()); + addr.DescribeAsString(true).AsString()); } } |