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

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

Issue 1084533002: Rename NetLogLogger and CapturingNetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NetLogLogger and CapturingNetLog(removed compiler error for chromeOS) Created 5 years, 8 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
« no previous file with comments | « AUTHORS ('k') | chrome/browser/extensions/api/log_private/log_private_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 14 matching lines...) Expand all
36 MOCK_METHOD1(OnDiscoveryRequest, void(DialService*)); 36 MOCK_METHOD1(OnDiscoveryRequest, void(DialService*));
37 MOCK_METHOD2(OnDeviceDiscovered, void(DialService*, const DialDeviceData&)); 37 MOCK_METHOD2(OnDeviceDiscovered, void(DialService*, const DialDeviceData&));
38 MOCK_METHOD1(OnDiscoveryFinished, void(DialService*)); 38 MOCK_METHOD1(OnDiscoveryFinished, void(DialService*));
39 MOCK_METHOD2(OnError, void(DialService*, 39 MOCK_METHOD2(OnError, void(DialService*,
40 const DialService::DialServiceErrorCode&)); 40 const DialService::DialServiceErrorCode&));
41 }; 41 };
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_(&test_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 test_net_log_;
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
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, &not_parsed)); 222 now, &not_parsed));
223 } 223 }
224 224
225 } // namespace extensions 225 } // namespace extensions
OLDNEW
« no previous file with comments | « AUTHORS ('k') | chrome/browser/extensions/api/log_private/log_private_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698