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

Side by Side Diff: net/base/address_tracker_linux_unittest.cc

Issue 691783003: [WIP NOT FOR COMMIT] Switch Android to libc++ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "net/base/address_tracker_linux.h" 6 #include "net/base/address_tracker_linux.h"
7 7
8 #include <linux/if.h> 8 #include <linux/if.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 attr.nla_type = type; 115 attr.nla_type = type;
116 Append(&attr, sizeof(attr)); 116 Append(&attr, sizeof(attr));
117 Align(); 117 Align();
118 Append(data, length); 118 Append(data, length);
119 Align(); 119 Align();
120 } 120 }
121 121
122 void AppendTo(Buffer* output) const { 122 void AppendTo(Buffer* output) const {
123 CHECK_EQ(NLMSG_ALIGN(output->size()), output->size()); 123 CHECK_EQ(NLMSG_ALIGN(output->size()), output->size());
124 output->reserve(output->size() + NLMSG_LENGTH(buffer_.size())); 124 output->reserve(output->size() + NLMSG_LENGTH(buffer_.size()));
125 output->insert(output->end(), buffer_.begin(), buffer_.end()); 125 output->insert(output->end(), buffer_.begin(), buffer_.end());
Fabrice (no longer in Chrome) 2014/11/12 11:52:29 That's the line that fails to compile with buffer_
Nico 2014/11/13 06:21:12 Bizarre, output and buffer_ have the same type. Oh
Fabrice (no longer in Chrome) 2014/11/13 10:52:07 Turns out the issue is the same in both tests. I h
126 } 126 }
127 127
128 private: 128 private:
129 void Append(const void* data, size_t length) { 129 void Append(const void* data, size_t length) {
130 const char* chardata = reinterpret_cast<const char*>(data); 130 const char* chardata = reinterpret_cast<const char*>(data);
131 buffer_.insert(buffer_.end(), chardata, chardata + length); 131 buffer_.insert(buffer_.end(), chardata, chardata + length);
132 } 132 }
133 133
134 void Align() { 134 void Align() {
135 header()->nlmsg_len = buffer_.size(); 135 header()->nlmsg_len = buffer_.size();
136 buffer_.insert(buffer_.end(), NLMSG_ALIGN(buffer_.size()) - buffer_.size(), 136 buffer_.insert(buffer_.end(), NLMSG_ALIGN(buffer_.size()) - buffer_.size(),
137 0); 137 0);
138 CHECK(NLMSG_OK(header(), buffer_.size())); 138 CHECK(NLMSG_OK(header(), buffer_.size()));
139 } 139 }
140 140
141 struct nlmsghdr* header() { 141 struct nlmsghdr* header() {
142 return reinterpret_cast<struct nlmsghdr*>(&buffer_[0]); 142 return reinterpret_cast<struct nlmsghdr*>(&buffer_[0]);
143 } 143 }
144 144
145 Buffer buffer_; 145 std::vector<int8_t> buffer_;
Fabrice (no longer in Chrome) 2014/11/12 11:52:29 Sorry, I missed it. This only fails with GCC, Clan
146 }; 146 };
147 147
148 #define INFINITY_LIFE_TIME 0xFFFFFFFF 148 #define INFINITY_LIFE_TIME 0xFFFFFFFF
149 149
150 void MakeAddrMessageWithCacheInfo(uint16 type, 150 void MakeAddrMessageWithCacheInfo(uint16 type,
151 uint8 flags, 151 uint8 flags,
152 uint8 family, 152 uint8 family,
153 const IPAddressNumber& address, 153 const IPAddressNumber& address,
154 const IPAddressNumber& local, 154 const IPAddressNumber& local,
155 uint32 preferred_lifetime, 155 uint32 preferred_lifetime,
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 547
548 TEST_F(AddressTrackerLinuxTest, NonTrackingModeInit) { 548 TEST_F(AddressTrackerLinuxTest, NonTrackingModeInit) {
549 AddressTrackerLinux tracker; 549 AddressTrackerLinux tracker;
550 tracker.Init(); 550 tracker.Init();
551 } 551 }
552 552
553 } // namespace 553 } // namespace
554 554
555 } // namespace internal 555 } // namespace internal
556 } // namespace net 556 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698