| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | 5 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" | 
| 6 | 6 | 
| 7 #include "chrome/browser/local_discovery/privet_http_impl.h" | 7 #include "chrome/browser/local_discovery/privet_http_impl.h" | 
| 8 #include "chrome/browser/local_discovery/privet_notifications.h" | 8 #include "chrome/browser/local_discovery/privet_notifications.h" | 
| 9 #include "net/url_request/test_url_fetcher_factory.h" | 9 #include "net/url_request/test_url_fetcher_factory.h" | 
| 10 #include "net/url_request/url_request_test_util.h" | 10 #include "net/url_request/url_request_test_util.h" | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 44     MockResolution( | 44     MockResolution( | 
| 45         const std::string& name, | 45         const std::string& name, | 
| 46         net::URLRequestContextGetter* request_context, | 46         net::URLRequestContextGetter* request_context, | 
| 47         const ResultCallback& callback) | 47         const ResultCallback& callback) | 
| 48         : name_(name), request_context_(request_context), callback_(callback) { | 48         : name_(name), request_context_(request_context), callback_(callback) { | 
| 49     } | 49     } | 
| 50 | 50 | 
| 51     virtual ~MockResolution() { | 51     virtual ~MockResolution() { | 
| 52     } | 52     } | 
| 53 | 53 | 
| 54     virtual void Start() OVERRIDE { | 54     virtual void Start() override { | 
| 55       callback_.Run(scoped_ptr<PrivetHTTPClient>(new PrivetHTTPClientImpl( | 55       callback_.Run(scoped_ptr<PrivetHTTPClient>(new PrivetHTTPClientImpl( | 
| 56           name_, net::HostPortPair("1.2.3.4", 8080), request_context_.get()))); | 56           name_, net::HostPortPair("1.2.3.4", 8080), request_context_.get()))); | 
| 57     } | 57     } | 
| 58 | 58 | 
| 59     virtual const std::string& GetName() OVERRIDE { | 59     virtual const std::string& GetName() override { | 
| 60       return name_; | 60       return name_; | 
| 61     } | 61     } | 
| 62 | 62 | 
| 63    private: | 63    private: | 
| 64     std::string name_; | 64     std::string name_; | 
| 65     scoped_refptr<net::URLRequestContextGetter> request_context_; | 65     scoped_refptr<net::URLRequestContextGetter> request_context_; | 
| 66     ResultCallback callback_; | 66     ResultCallback callback_; | 
| 67   }; | 67   }; | 
| 68 | 68 | 
| 69   explicit MockPrivetHttpFactory(net::URLRequestContextGetter* request_context) | 69   explicit MockPrivetHttpFactory(net::URLRequestContextGetter* request_context) | 
| 70       : request_context_(request_context) { | 70       : request_context_(request_context) { | 
| 71   } | 71   } | 
| 72 | 72 | 
| 73   virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( | 73   virtual scoped_ptr<PrivetHTTPResolution> CreatePrivetHTTP( | 
| 74       const std::string& name, | 74       const std::string& name, | 
| 75       const net::HostPortPair& address, | 75       const net::HostPortPair& address, | 
| 76       const ResultCallback& callback) OVERRIDE { | 76       const ResultCallback& callback) override { | 
| 77     return scoped_ptr<PrivetHTTPResolution>( | 77     return scoped_ptr<PrivetHTTPResolution>( | 
| 78         new MockResolution(name, request_context_.get(), callback)); | 78         new MockResolution(name, request_context_.get(), callback)); | 
| 79   } | 79   } | 
| 80 | 80 | 
| 81  private: | 81  private: | 
| 82     scoped_refptr<net::URLRequestContextGetter> request_context_; | 82     scoped_refptr<net::URLRequestContextGetter> request_context_; | 
| 83 }; | 83 }; | 
| 84 | 84 | 
| 85 class PrivetNotificationsListenerTest : public ::testing::Test { | 85 class PrivetNotificationsListenerTest : public ::testing::Test { | 
| 86  public: | 86  public: | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 211       true, | 211       true, | 
| 212       kExampleDeviceName, | 212       kExampleDeviceName, | 
| 213       description_); | 213       description_); | 
| 214 | 214 | 
| 215   SuccessfulResponseToInfo(kInfoResponseNoUptime); | 215   SuccessfulResponseToInfo(kInfoResponseNoUptime); | 
| 216 } | 216 } | 
| 217 | 217 | 
| 218 }  // namespace | 218 }  // namespace | 
| 219 | 219 | 
| 220 }  // namespace local_discovery | 220 }  // namespace local_discovery | 
| OLD | NEW | 
|---|