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

Side by Side Diff: chrome/browser/extensions/api/dial/dial_service_unittest.cc

Issue 538243003: proposed interface change at //net for webrtc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Split address_tracker_linux into a different CL. Created 6 years, 3 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 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/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "chrome/browser/extensions/api/dial/dial_device_data.h" 8 #include "chrome/browser/extensions/api/dial/dial_device_data.h"
9 #include "chrome/browser/extensions/api/dial/dial_service.h" 9 #include "chrome/browser/extensions/api/dial/dial_service.h"
10 #include "net/base/capturing_net_log.h" 10 #include "net/base/capturing_net_log.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 TEST_F(DialServiceTest, TestMultipleNetworkInterfaces) { 76 TEST_F(DialServiceTest, TestMultipleNetworkInterfaces) {
77 base::MessageLoopForIO loop; 77 base::MessageLoopForIO loop;
78 // Setting the finish delay to zero disables the timer that invokes 78 // Setting the finish delay to zero disables the timer that invokes
79 // FinishDiscovery(). 79 // FinishDiscovery().
80 dial_service_.finish_delay_ = TimeDelta::FromSeconds(0); 80 dial_service_.finish_delay_ = TimeDelta::FromSeconds(0);
81 dial_service_.request_interval_ = TimeDelta::FromSeconds(0); 81 dial_service_.request_interval_ = TimeDelta::FromSeconds(0);
82 dial_service_.max_requests_ = 4; 82 dial_service_.max_requests_ = 4;
83 dial_service_.discovery_active_ = true; 83 dial_service_.discovery_active_ = true;
84 net::NetworkInterfaceList interface_list; 84 net::NetworkInterfaceList interface_list;
85 interface_list.push_back( 85 interface_list.push_back(
86 net::NetworkInterface("network1", "network1", 0, 86 net::NetworkInterface("network1",
87 "network1",
88 0,
87 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 89 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
88 mock_ip_, 0)); 90 mock_ip_,
91 0,
92 net::IP_ADDRESS_ATTRIBUTE_NONE));
89 interface_list.push_back( 93 interface_list.push_back(
90 net::NetworkInterface("network2", "network2", 1, 94 net::NetworkInterface("network2",
95 "network2",
96 1,
91 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 97 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
92 mock_ip_, 0)); 98 mock_ip_,
99 0,
100 net::IP_ADDRESS_ATTRIBUTE_NONE));
93 interface_list.push_back( 101 interface_list.push_back(
94 net::NetworkInterface("network3", "network3", 2, 102 net::NetworkInterface("network3",
103 "network3",
104 2,
95 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 105 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
96 mock_ip_, 0)); 106 mock_ip_,
107 0,
108 net::IP_ADDRESS_ATTRIBUTE_NONE));
97 109
98 // "network4" is equivalent to "network2" because both the address family 110 // "network4" is equivalent to "network2" because both the address family
99 // and interface index are the same. 111 // and interface index are the same.
100 interface_list.push_back( 112 interface_list.push_back(
101 net::NetworkInterface("network4", "network4", 1, 113 net::NetworkInterface("network4",
114 "network4",
115 1,
102 net::NetworkChangeNotifier::CONNECTION_UNKNOWN, 116 net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
103 mock_ip_, 0)); 117 mock_ip_,
118 0,
119 net::IP_ADDRESS_ATTRIBUTE_NONE));
104 120
105 // 3 sockets * 4 requests per socket = 12 requests 121 // 3 sockets * 4 requests per socket = 12 requests
106 EXPECT_CALL(mock_observer_, OnDiscoveryRequest(A<DialService*>())).Times(12); 122 EXPECT_CALL(mock_observer_, OnDiscoveryRequest(A<DialService*>())).Times(12);
107 EXPECT_CALL(mock_observer_, OnDiscoveryFinished(A<DialService*>())).Times(1); 123 EXPECT_CALL(mock_observer_, OnDiscoveryFinished(A<DialService*>())).Times(1);
108 124
109 dial_service_.SendNetworkList(interface_list); 125 dial_service_.SendNetworkList(interface_list);
110 EXPECT_EQ(3u, dial_service_.dial_sockets_.size()); 126 EXPECT_EQ(3u, dial_service_.dial_sockets_.size());
111 127
112 loop.RunUntilIdle(); 128 loop.RunUntilIdle();
113 dial_service_.FinishDiscovery(); 129 dial_service_.FinishDiscovery();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 216
201 // Empty USN 217 // Empty USN
202 EXPECT_FALSE(DialServiceImpl::DialSocket::ParseResponse( 218 EXPECT_FALSE(DialServiceImpl::DialSocket::ParseResponse(
203 "HTTP/1.1 OK\r\n" 219 "HTTP/1.1 OK\r\n"
204 "LOCATION: http://127.0.0.1/dd.xml\r\n" 220 "LOCATION: http://127.0.0.1/dd.xml\r\n"
205 "USN:\r\n\r\n", 221 "USN:\r\n\r\n",
206 now, &not_parsed)); 222 now, &not_parsed));
207 } 223 }
208 224
209 } // namespace extensions 225 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_traffic_detector.cc » ('j') | net/base/net_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698