OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/privetv3_setup_flow.h" | 5 #include "chrome/browser/local_discovery/privetv3_setup_flow.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "chrome/browser/local_discovery/gcd_api_flow.h" | 9 #include "chrome/browser/local_discovery/gcd_api_flow.h" |
10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation( | 54 virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation( |
55 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE { | 55 const PrivetJSONOperation::ResultCallback& callback) OVERRIDE { |
56 return make_scoped_ptr(CreateInfoOperationPtr(callback)); | 56 return make_scoped_ptr(CreateInfoOperationPtr(callback)); |
57 } | 57 } |
58 | 58 |
59 virtual scoped_ptr<PrivetURLFetcher> CreateURLFetcher( | 59 virtual scoped_ptr<PrivetURLFetcher> CreateURLFetcher( |
60 const GURL& url, | 60 const GURL& url, |
61 net::URLFetcher::RequestType request_type, | 61 net::URLFetcher::RequestType request_type, |
62 PrivetURLFetcher::Delegate* delegate) OVERRIDE { | 62 PrivetURLFetcher::Delegate* delegate) OVERRIDE { |
63 return make_scoped_ptr( | 63 return make_scoped_ptr(new PrivetURLFetcher( |
64 new PrivetURLFetcher(url, request_type, request_context_, delegate)); | 64 url, request_type, request_context_.get(), delegate)); |
65 } | 65 } |
66 | 66 |
67 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 67 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
68 }; | 68 }; |
69 | 69 |
70 class MockDelegate : public PrivetV3SetupFlow::Delegate { | 70 class MockDelegate : public PrivetV3SetupFlow::Delegate { |
71 public: | 71 public: |
72 MockDelegate() : privet_client_ptr_(NULL) {} | 72 MockDelegate() : privet_client_ptr_(NULL) {} |
73 | 73 |
74 class MockGCDApiFlow : public GCDApiFlow { | 74 class MockGCDApiFlow : public GCDApiFlow { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 WithArgs<1>(Invoke(this, &PrivetV3SetupFlowTest::ConfirmCode))); | 184 WithArgs<1>(Invoke(this, &PrivetV3SetupFlowTest::ConfirmCode))); |
185 delegate_.gcd_server_response_ = kRegistrationTicketResponse; | 185 delegate_.gcd_server_response_ = kRegistrationTicketResponse; |
186 setup_.Register(kServiceName); | 186 setup_.Register(kServiceName); |
187 run_loop_.Run(); | 187 run_loop_.Run(); |
188 SimulateFetch(200, "{}"); | 188 SimulateFetch(200, "{}"); |
189 } | 189 } |
190 | 190 |
191 } // namespace | 191 } // namespace |
192 | 192 |
193 } // namespace local_discovery | 193 } // namespace local_discovery |
OLD | NEW |