| 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 "base/bind.h" | 5 #include "base/bind.h" | 
| 6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" | 
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" | 
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" | 
| 9 #include "chrome/browser/local_discovery/privet_http_impl.h" | 9 #include "chrome/browser/local_discovery/privet_http_impl.h" | 
| 10 #include "net/base/host_port_pair.h" | 10 #include "net/base/host_port_pair.h" | 
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 235   MOCK_METHOD1(OnRequestEnd, void(int fetcher_id)); | 235   MOCK_METHOD1(OnRequestEnd, void(int fetcher_id)); | 
| 236 }; | 236 }; | 
| 237 | 237 | 
| 238 class PrivetHTTPTest : public ::testing::Test { | 238 class PrivetHTTPTest : public ::testing::Test { | 
| 239  public: | 239  public: | 
| 240   PrivetHTTPTest() { | 240   PrivetHTTPTest() { | 
| 241     PrivetURLFetcher::ResetTokenMapForTests(); | 241     PrivetURLFetcher::ResetTokenMapForTests(); | 
| 242 | 242 | 
| 243     request_context_= new net::TestURLRequestContextGetter( | 243     request_context_= new net::TestURLRequestContextGetter( | 
| 244         base::MessageLoopProxy::current()); | 244         base::MessageLoopProxy::current()); | 
| 245     privet_client_ = PrivetV1HTTPClient::CreateDefault( | 245     privet_client_ = | 
| 246         make_scoped_ptr<PrivetHTTPClient>( | 246         PrivetV1HTTPClient::CreateDefault(make_scoped_ptr<PrivetHTTPClient>( | 
| 247             new PrivetHTTPClientImpl("sampleDevice._privet._tcp.local", | 247             new PrivetHTTPClientImpl("sampleDevice._privet._tcp.local", | 
| 248                                      net::HostPortPair("10.0.0.8", 6006), | 248                                      net::HostPortPair("10.0.0.8", 6006), | 
| 249                                      request_context_))); | 249                                      request_context_.get()))); | 
| 250     fetcher_factory_.SetDelegateForTests(&fetcher_delegate_); | 250     fetcher_factory_.SetDelegateForTests(&fetcher_delegate_); | 
| 251   } | 251   } | 
| 252 | 252 | 
| 253   virtual ~PrivetHTTPTest() { | 253   virtual ~PrivetHTTPTest() { | 
| 254   } | 254   } | 
| 255 | 255 | 
| 256   bool SuccessfulResponseToURL(const GURL& url, | 256   bool SuccessfulResponseToURL(const GURL& url, | 
| 257                                const std::string& response) { | 257                                const std::string& response) { | 
| 258     net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0); | 258     net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0); | 
| 259     EXPECT_TRUE(fetcher); | 259     EXPECT_TRUE(fetcher); | 
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1086 | 1086 | 
| 1087   EXPECT_TRUE(SuccessfulResponseToURL( | 1087   EXPECT_TRUE(SuccessfulResponseToURL( | 
| 1088       GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 1088       GURL("http://10.0.0.8:6006/privet/printer/createjob"), | 
| 1089       kSampleCreatejobResponse)); | 1089       kSampleCreatejobResponse)); | 
| 1090 }; | 1090 }; | 
| 1091 | 1091 | 
| 1092 | 1092 | 
| 1093 }  // namespace | 1093 }  // namespace | 
| 1094 | 1094 | 
| 1095 }  // namespace local_discovery | 1095 }  // namespace local_discovery | 
| OLD | NEW | 
|---|