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

Unified Diff: net/dns/address_sorter_posix_unittest.cc

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: net/dns/address_sorter_posix_unittest.cc
diff --git a/net/dns/address_sorter_posix_unittest.cc b/net/dns/address_sorter_posix_unittest.cc
index dea7ade0fea9a559d88f1d6bba06322e3e1333e2..41f82b618f657ddb01e73dd004e4145128c1bf14 100644
--- a/net/dns/address_sorter_posix_unittest.cc
+++ b/net/dns/address_sorter_posix_unittest.cc
@@ -31,7 +31,7 @@ IPAddressNumber ParseIP(const std::string& str) {
class TestUDPClientSocket : public DatagramClientSocket {
public:
explicit TestUDPClientSocket(const AddressMapping* mapping)
- : mapping_(mapping), connected_(false) {}
+ : mapping_(mapping), connected_(false) {}
virtual ~TestUDPClientSocket() {}
@@ -43,12 +43,8 @@ class TestUDPClientSocket : public DatagramClientSocket {
NOTIMPLEMENTED();
return OK;
}
- virtual int SetReceiveBufferSize(int32) OVERRIDE {
- return OK;
- }
- virtual int SetSendBufferSize(int32) OVERRIDE {
- return OK;
- }
+ virtual int SetReceiveBufferSize(int32) OVERRIDE { return OK; }
+ virtual int SetSendBufferSize(int32) OVERRIDE { return OK; }
virtual void Close() OVERRIDE {}
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE {
@@ -73,9 +69,7 @@ class TestUDPClientSocket : public DatagramClientSocket {
return OK;
}
- virtual const BoundNetLog& NetLog() const OVERRIDE {
- return net_log_;
- }
+ virtual const BoundNetLog& NetLog() const OVERRIDE { return net_log_; }
private:
BoundNetLog net_log_;
@@ -114,9 +108,7 @@ class TestSocketFactory : public ClientSocketFactory {
NOTIMPLEMENTED();
return scoped_ptr<SSLClientSocket>();
}
- virtual void ClearSSLSessionCache() OVERRIDE {
- NOTIMPLEMENTED();
- }
+ virtual void ClearSSLSessionCache() OVERRIDE { NOTIMPLEMENTED(); }
void AddMapping(const IPAddressNumber& dst, const IPAddressNumber& src) {
mapping_[dst] = src;
@@ -168,17 +160,17 @@ class AddressSorterPosixTest : public testing::Test {
AddressList result;
TestCompletionCallback callback;
- sorter_.Sort(list, base::Bind(&OnSortComplete, &result,
- callback.callback()));
+ sorter_.Sort(list,
+ base::Bind(&OnSortComplete, &result, callback.callback()));
callback.WaitForResult();
for (size_t i = 0; (i < result.size()) || (order[i] >= 0); ++i) {
IPEndPoint expected = order[i] >= 0 ? list[order[i]] : IPEndPoint();
IPEndPoint actual = i < result.size() ? result[i] : IPEndPoint();
- EXPECT_TRUE(expected.address() == actual.address()) <<
- "Address out of order at position " << i << "\n" <<
- " Actual: " << actual.ToStringWithoutPort() << "\n" <<
- "Expected: " << expected.ToStringWithoutPort();
+ EXPECT_TRUE(expected.address() == actual.address())
+ << "Address out of order at position " << i << "\n"
+ << " Actual: " << actual.ToStringWithoutPort() << "\n"
+ << "Expected: " << expected.ToStringWithoutPort();
}
}
@@ -189,8 +181,8 @@ class AddressSorterPosixTest : public testing::Test {
// Rule 1: Avoid unusable destinations.
TEST_F(AddressSorterPosixTest, Rule1) {
AddMapping("10.0.0.231", "10.0.0.1");
- const char* addresses[] = { "::1", "10.0.0.231", "127.0.0.1", NULL };
- const int order[] = { 1, -1 };
+ const char* addresses[] = {"::1", "10.0.0.231", "127.0.0.1", NULL};
+ const int order[] = {1, -1};
Verify(addresses, order);
}
@@ -203,12 +195,12 @@ TEST_F(AddressSorterPosixTest, Rule2) {
AddMapping("fec1::2", "fe81::10"); // site-local vs. link-local
AddMapping("8.0.0.1", "169.254.0.10"); // global vs. link-local
// In all three cases, matching scope is preferred.
- const int order[] = { 1, 0, -1 };
- const char* addresses1[] = { "3002::2", "3002::1", NULL };
+ const int order[] = {1, 0, -1};
+ const char* addresses1[] = {"3002::2", "3002::1", NULL};
Verify(addresses1, order);
- const char* addresses2[] = { "fec1::2", "ff32::1", NULL };
+ const char* addresses2[] = {"fec1::2", "ff32::1", NULL};
Verify(addresses2, order);
- const char* addresses3[] = { "8.0.0.1", "fec1::1", NULL };
+ const char* addresses3[] = {"8.0.0.1", "fec1::1", NULL};
Verify(addresses3, order);
}
@@ -218,8 +210,8 @@ TEST_F(AddressSorterPosixTest, Rule3) {
AddMapping("3002::1", "4000::10");
GetSourceInfo("4000::10")->deprecated = true;
AddMapping("3002::2", "4000::20");
- const char* addresses[] = { "3002::1", "3002::2", NULL };
- const int order[] = { 1, 0, -1 };
+ const char* addresses[] = {"3002::1", "3002::2", NULL};
+ const int order[] = {1, 0, -1};
Verify(addresses, order);
}
@@ -228,8 +220,8 @@ TEST_F(AddressSorterPosixTest, Rule4) {
AddMapping("3002::1", "4000::10");
AddMapping("3002::2", "4000::20");
GetSourceInfo("4000::20")->home = true;
- const char* addresses[] = { "3002::1", "3002::2", NULL };
- const int order[] = { 1, 0, -1 };
+ const char* addresses[] = {"3002::1", "3002::2", NULL};
+ const int order[] = {1, 0, -1};
Verify(addresses, order);
}
@@ -239,13 +231,13 @@ TEST_F(AddressSorterPosixTest, Rule5) {
AddMapping("::ffff:1234:1", "::ffff:1234:10"); // matching IPv4-mapped
AddMapping("2001::1", "::ffff:1234:10"); // Teredo vs. IPv4-mapped
AddMapping("2002::1", "2001::10"); // 6to4 vs. Teredo
- const int order[] = { 1, 0, -1 };
+ const int order[] = {1, 0, -1};
{
- const char* addresses[] = { "2001::1", "::1", NULL };
+ const char* addresses[] = {"2001::1", "::1", NULL};
Verify(addresses, order);
}
{
- const char* addresses[] = { "2002::1", "::ffff:1234:1", NULL };
+ const char* addresses[] = {"2002::1", "::ffff:1234:1", NULL};
Verify(addresses, order);
}
}
@@ -256,9 +248,9 @@ TEST_F(AddressSorterPosixTest, Rule6) {
AddMapping("ff32::1", "fe81::10"); // multicast
AddMapping("::ffff:1234:1", "::ffff:1234:10"); // IPv4-mapped
AddMapping("2001::1", "2001::10"); // Teredo
- const char* addresses[] = { "2001::1", "::ffff:1234:1", "ff32::1", "::1",
- NULL };
- const int order[] = { 3, 2, 1, 0, -1 };
+ const char* addresses[] = {"2001::1", "::ffff:1234:1", "ff32::1", "::1",
+ NULL};
+ const int order[] = {3, 2, 1, 0, -1};
Verify(addresses, order);
}
@@ -267,8 +259,8 @@ TEST_F(AddressSorterPosixTest, Rule7) {
AddMapping("3002::1", "4000::10");
AddMapping("3002::2", "4000::20");
GetSourceInfo("4000::20")->native = true;
- const char* addresses[] = { "3002::1", "3002::2", NULL };
- const int order[] = { 1, 0, -1 };
+ const char* addresses[] = {"3002::1", "3002::2", NULL};
+ const int order[] = {1, 0, -1};
Verify(addresses, order);
}
@@ -281,9 +273,9 @@ TEST_F(AddressSorterPosixTest, Rule8) {
AddMapping("ff32::1", "4000::10"); // link-local
AddMapping("ff35::1", "4000::10"); // site-local
AddMapping("ff38::1", "4000::10"); // org-local
- const char* addresses[] = { "ff38::1", "3000::1", "ff35::1", "ff32::1",
- "fe81::1", NULL };
- const int order[] = { 4, 1, 3, 2, 0, -1 };
+ const char* addresses[] = {"ff38::1", "3000::1", "ff35::1",
+ "ff32::1", "fe81::1", NULL};
+ const int order[] = {4, 1, 3, 2, 0, -1};
Verify(addresses, order);
}
@@ -291,13 +283,12 @@ TEST_F(AddressSorterPosixTest, Rule8) {
TEST_F(AddressSorterPosixTest, Rule9) {
AddMapping("3000::1", "3000:ffff::10"); // 16 bit match
GetSourceInfo("3000:ffff::10")->prefix_length = 16;
- AddMapping("4000::1", "4000::10"); // 123 bit match, limited to 15
+ AddMapping("4000::1", "4000::10"); // 123 bit match, limited to 15
GetSourceInfo("4000::10")->prefix_length = 15;
- AddMapping("4002::1", "4000::10"); // 14 bit match
- AddMapping("4080::1", "4000::10"); // 8 bit match
- const char* addresses[] = { "4080::1", "4002::1", "4000::1", "3000::1",
- NULL };
- const int order[] = { 3, 2, 1, 0, -1 };
+ AddMapping("4002::1", "4000::10"); // 14 bit match
+ AddMapping("4080::1", "4000::10"); // 8 bit match
+ const char* addresses[] = {"4080::1", "4002::1", "4000::1", "3000::1", NULL};
+ const int order[] = {3, 2, 1, 0, -1};
Verify(addresses, order);
}
@@ -306,8 +297,8 @@ TEST_F(AddressSorterPosixTest, Rule10) {
AddMapping("4000::1", "4000::10");
AddMapping("4000::2", "4000::10");
AddMapping("4000::3", "4000::10");
- const char* addresses[] = { "4000::1", "4000::2", "4000::3", NULL };
- const int order[] = { 0, 1, 2, -1 };
+ const char* addresses[] = {"4000::1", "4000::2", "4000::3", NULL};
+ const int order[] = {0, 1, 2, -1};
Verify(addresses, order);
}
@@ -318,9 +309,9 @@ TEST_F(AddressSorterPosixTest, MultipleRules) {
AddMapping("4000::1", "4000::10"); // global unicast
AddMapping("ff32::2", "fe81::20"); // deprecated link-local multicast
GetSourceInfo("fe81::20")->deprecated = true;
- const char* addresses[] = { "ff3e::1", "ff32::2", "4000::1", "ff32::1", "::1",
- "8.0.0.1", NULL };
- const int order[] = { 4, 3, 0, 2, 1, -1 };
+ const char* addresses[] = {"ff3e::1", "ff32::2", "4000::1", "ff32::1",
+ "::1", "8.0.0.1", NULL};
+ const int order[] = {4, 3, 0, 2, 1, -1};
Verify(addresses, order);
}

Powered by Google App Engine
This is Rietveld 408576698