OLD | NEW |
---|---|
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/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "net/log/capturing_net_log.h" | 11 #include "net/log/test_net_log.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using base::Time; | 15 using base::Time; |
16 using base::TimeDelta; | 16 using base::TimeDelta; |
17 using ::testing::A; | 17 using ::testing::A; |
18 using ::testing::AtLeast; | 18 using ::testing::AtLeast; |
19 using ::testing::Return; | 19 using ::testing::Return; |
20 | 20 |
21 namespace { | 21 namespace { |
(...skipping 20 matching lines...) Expand all Loading... | |
42 | 42 |
43 class DialServiceTest : public testing::Test { | 43 class DialServiceTest : public testing::Test { |
44 public: | 44 public: |
45 DialServiceTest() | 45 DialServiceTest() |
46 : dial_service_(&capturing_net_log_) { | 46 : dial_service_(&capturing_net_log_) { |
47 CHECK(net::ParseIPLiteralToNumber("0.0.0.0", &mock_ip_)); | 47 CHECK(net::ParseIPLiteralToNumber("0.0.0.0", &mock_ip_)); |
48 dial_service_.AddObserver(&mock_observer_); | 48 dial_service_.AddObserver(&mock_observer_); |
49 dial_socket_ = dial_service_.CreateDialSocket(); | 49 dial_socket_ = dial_service_.CreateDialSocket(); |
50 } | 50 } |
51 protected: | 51 protected: |
52 net::CapturingNetLog capturing_net_log_; | 52 net::TestNetLog capturing_net_log_; |
eroman
2015/04/14 20:06:12
As a follow up, I would like to additionally renam
| |
53 net::IPAddressNumber mock_ip_; | 53 net::IPAddressNumber mock_ip_; |
54 DialServiceImpl dial_service_; | 54 DialServiceImpl dial_service_; |
55 scoped_ptr<DialServiceImpl::DialSocket> dial_socket_; | 55 scoped_ptr<DialServiceImpl::DialSocket> dial_socket_; |
56 MockObserver mock_observer_; | 56 MockObserver mock_observer_; |
57 }; | 57 }; |
58 | 58 |
59 TEST_F(DialServiceTest, TestSendMultipleRequests) { | 59 TEST_F(DialServiceTest, TestSendMultipleRequests) { |
60 base::MessageLoopForIO loop; | 60 base::MessageLoopForIO loop; |
61 // Setting the finish delay to zero disables the timer that invokes | 61 // Setting the finish delay to zero disables the timer that invokes |
62 // FinishDiscovery(). | 62 // FinishDiscovery(). |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 | 216 |
217 // Empty USN | 217 // Empty USN |
218 EXPECT_FALSE(DialServiceImpl::DialSocket::ParseResponse( | 218 EXPECT_FALSE(DialServiceImpl::DialSocket::ParseResponse( |
219 "HTTP/1.1 OK\r\n" | 219 "HTTP/1.1 OK\r\n" |
220 "LOCATION: http://127.0.0.1/dd.xml\r\n" | 220 "LOCATION: http://127.0.0.1/dd.xml\r\n" |
221 "USN:\r\n\r\n", | 221 "USN:\r\n\r\n", |
222 now, ¬_parsed)); | 222 now, ¬_parsed)); |
223 } | 223 } |
224 | 224 |
225 } // namespace extensions | 225 } // namespace extensions |
OLD | NEW |