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

Side by Side Diff: remoting/test/chromoting_test_driver_environment.cc

Issue 2542343004: Updating the Chromoting Test Driver to target the test environment (Closed)
Patch Set: Addressing feedback Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/test/chromoting_test_driver_environment.h" 5 #include "remoting/test/chromoting_test_driver_environment.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 16 matching lines...) Expand all
27 ChromotingTestDriverEnvironment::EnvironmentOptions::~EnvironmentOptions() { 27 ChromotingTestDriverEnvironment::EnvironmentOptions::~EnvironmentOptions() {
28 } 28 }
29 29
30 ChromotingTestDriverEnvironment::ChromotingTestDriverEnvironment( 30 ChromotingTestDriverEnvironment::ChromotingTestDriverEnvironment(
31 const EnvironmentOptions& options) 31 const EnvironmentOptions& options)
32 : host_name_(options.host_name), 32 : host_name_(options.host_name),
33 host_jid_(options.host_jid), 33 host_jid_(options.host_jid),
34 user_name_(options.user_name), 34 user_name_(options.user_name),
35 pin_(options.pin), 35 pin_(options.pin),
36 refresh_token_file_path_(options.refresh_token_file_path), 36 refresh_token_file_path_(options.refresh_token_file_path),
37 test_access_token_fetcher_(nullptr), 37 use_test_environment_(options.use_test_environment) {
38 test_refresh_token_store_(nullptr),
39 test_host_list_fetcher_(nullptr) {
40 DCHECK(!user_name_.empty()); 38 DCHECK(!user_name_.empty());
41 DCHECK(!host_name_.empty()); 39 DCHECK(!host_name_.empty());
42 } 40 }
43 41
44 ChromotingTestDriverEnvironment::~ChromotingTestDriverEnvironment() { 42 ChromotingTestDriverEnvironment::~ChromotingTestDriverEnvironment() {
45 } 43 }
46 44
47 bool ChromotingTestDriverEnvironment::Initialize( 45 bool ChromotingTestDriverEnvironment::Initialize(
48 const std::string& auth_code) { 46 const std::string& auth_code) {
49 if (!access_token_.empty()) { 47 if (!access_token_.empty()) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 HostListFetcher* host_list_fetcher = test_host_list_fetcher_; 285 HostListFetcher* host_list_fetcher = test_host_list_fetcher_;
288 if (!host_list_fetcher) { 286 if (!host_list_fetcher) {
289 temporary_host_list_fetcher.reset(new HostListFetcher()); 287 temporary_host_list_fetcher.reset(new HostListFetcher());
290 host_list_fetcher = temporary_host_list_fetcher.get(); 288 host_list_fetcher = temporary_host_list_fetcher.get();
291 } 289 }
292 290
293 remoting::test::HostListFetcher::HostlistCallback host_list_callback = 291 remoting::test::HostListFetcher::HostlistCallback host_list_callback =
294 base::Bind(&ChromotingTestDriverEnvironment::OnHostListRetrieved, 292 base::Bind(&ChromotingTestDriverEnvironment::OnHostListRetrieved,
295 base::Unretained(this), run_loop.QuitClosure()); 293 base::Unretained(this), run_loop.QuitClosure());
296 294
297 host_list_fetcher->RetrieveHostlist(access_token_, host_list_callback); 295 host_list_fetcher->RetrieveHostlist(
296 access_token_,
297 use_test_environment_ ? kHostListTestRequestUrl : kHostListProdRequestUrl,
298 host_list_callback);
298 299
299 run_loop.Run(); 300 run_loop.Run();
300 301
301 if (host_list_.empty()) { 302 if (host_list_.empty()) {
302 // Note: Access token may have expired, but it is unlikely. 303 // Note: Access token may have expired, but it is unlikely.
303 LOG(ERROR) << "Retrieved host list is empty.\n" 304 LOG(ERROR) << "Retrieved host list is empty.\n"
304 << "Does the account have hosts set up?"; 305 << "Does the account have hosts set up?";
305 return false; 306 return false;
306 } 307 }
307 308
(...skipping 26 matching lines...) Expand all
334 const std::vector<HostInfo>& retrieved_host_list) { 335 const std::vector<HostInfo>& retrieved_host_list) {
335 VLOG(1) << "OnHostListRetrieved() Called"; 336 VLOG(1) << "OnHostListRetrieved() Called";
336 337
337 host_list_ = retrieved_host_list; 338 host_list_ = retrieved_host_list;
338 339
339 done_closure.Run(); 340 done_closure.Run();
340 } 341 }
341 342
342 } // namespace test 343 } // namespace test
343 } // namespace remoting 344 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/chromoting_test_driver_environment.h ('k') | remoting/test/chromoting_test_driver_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698