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

Side by Side Diff: chrome/browser/local_discovery/privetv3_setup_flow_unittest.cc

Issue 640353003: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 6 years, 2 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
OLDNEW
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 MockDelegate* delegate_; 85 MockDelegate* delegate_;
86 }; 86 };
87 87
88 MOCK_METHOD1(GetWiFiCredentials, void(const CredentialsCallback&)); 88 MOCK_METHOD1(GetWiFiCredentials, void(const CredentialsCallback&));
89 MOCK_METHOD1(SwitchToSetupWiFi, void(const ResultCallback&)); 89 MOCK_METHOD1(SwitchToSetupWiFi, void(const ResultCallback&));
90 virtual void CreatePrivetV3Client( 90 virtual void CreatePrivetV3Client(
91 const std::string& service_name, 91 const std::string& service_name,
92 const PrivetClientCallback& callback) override { 92 const PrivetClientCallback& callback) override {
93 scoped_ptr<MockPrivetHTTPClient> privet_client(new MockPrivetHTTPClient()); 93 scoped_ptr<MockPrivetHTTPClient> privet_client(new MockPrivetHTTPClient());
94 privet_client_ptr_ = privet_client.get(); 94 privet_client_ptr_ = privet_client.get();
95 callback.Run(privet_client.PassAs<PrivetHTTPClient>()); 95 callback.Run(privet_client.Pass());
96 } 96 }
97 MOCK_METHOD2(ConfirmSecurityCode, 97 MOCK_METHOD2(ConfirmSecurityCode,
98 void(const std::string&, const ResultCallback&)); 98 void(const std::string&, const ResultCallback&));
99 MOCK_METHOD1(RestoreWifi, void(const ResultCallback&)); 99 MOCK_METHOD1(RestoreWifi, void(const ResultCallback&));
100 MOCK_METHOD0(OnSetupDone, void()); 100 MOCK_METHOD0(OnSetupDone, void());
101 MOCK_METHOD0(OnSetupError, void()); 101 MOCK_METHOD0(OnSetupError, void());
102 102
103 virtual scoped_ptr<GCDApiFlow> CreateApiFlow() override { 103 virtual scoped_ptr<GCDApiFlow> CreateApiFlow() override {
104 scoped_ptr<MockGCDApiFlow> mock_gcd(new MockGCDApiFlow(this)); 104 return make_scoped_ptr(new MockGCDApiFlow(this));
105 return mock_gcd.PassAs<GCDApiFlow>();
106 } 105 }
107 106
108 void ReplyWithToken() { 107 void ReplyWithToken() {
109 scoped_ptr<base::Value> value(base::JSONReader::Read(gcd_server_response_)); 108 scoped_ptr<base::Value> value(base::JSONReader::Read(gcd_server_response_));
110 const base::DictionaryValue* dictionary = NULL; 109 const base::DictionaryValue* dictionary = NULL;
111 value->GetAsDictionary(&dictionary); 110 value->GetAsDictionary(&dictionary);
112 gcd_request_->OnGCDAPIFlowComplete(*dictionary); 111 gcd_request_->OnGCDAPIFlowComplete(*dictionary);
113 } 112 }
114 113
115 std::string gcd_server_response_; 114 std::string gcd_server_response_;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 WithArgs<1>(Invoke(this, &PrivetV3SetupFlowTest::ConfirmCode))); 183 WithArgs<1>(Invoke(this, &PrivetV3SetupFlowTest::ConfirmCode)));
185 delegate_.gcd_server_response_ = kRegistrationTicketResponse; 184 delegate_.gcd_server_response_ = kRegistrationTicketResponse;
186 setup_.Register(kServiceName); 185 setup_.Register(kServiceName);
187 run_loop_.Run(); 186 run_loop_.Run();
188 SimulateFetch(200, "{}"); 187 SimulateFetch(200, "{}");
189 } 188 }
190 189
191 } // namespace 190 } // namespace
192 191
193 } // namespace local_discovery 192 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698