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

Side by Side Diff: remoting/test/host_list_fetcher.h

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
« no previous file with comments | « remoting/test/fake_host_list_fetcher.cc ('k') | remoting/test/host_list_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef REMOTING_TEST_HOST_LIST_FETCHER_H_ 5 #ifndef REMOTING_TEST_HOST_LIST_FETCHER_H_
6 #define REMOTING_TEST_HOST_LIST_FETCHER_H_ 6 #define REMOTING_TEST_HOST_LIST_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 class URLRequestContextGetter; 22 class URLRequestContextGetter;
23 } 23 }
24 24
25 namespace remoting { 25 namespace remoting {
26 namespace test { 26 namespace test {
27 27
28 // Used by the HostlistFetcher to make HTTP requests and also by the 28 // Used by the HostlistFetcher to make HTTP requests and also by the
29 // unittests for this class to set fake response data for these URLs. 29 // unittests for this class to set fake response data for these URLs.
30 const char kHostListProdRequestUrl[] = "https://www.googleapis.com/" 30 const char kHostListProdRequestUrl[] = "https://www.googleapis.com/"
31 "chromoting/v1/@me/hosts"; 31 "chromoting/v1/@me/hosts";
32 const char kHostListTestRequestUrl[] =
33 "https://www-googleapis-test.sandbox.google.com/chromoting/v1/@me/hosts";
32 34
33 // Requests a host list from the directory service for an access token. 35 // Requests a host list from the directory service for an access token.
34 // Destroying the RemoteHostInfoFetcher while a request is outstanding 36 // Destroying the RemoteHostInfoFetcher while a request is outstanding
35 // will cancel the request. It is safe to delete the fetcher from within a 37 // will cancel the request. It is safe to delete the fetcher from within a
36 // completion callback. Must be used from a thread running a message loop. 38 // completion callback. Must be used from a thread running a message loop.
37 // The public method is virtual to allow for mocking and fakes. 39 // The public method is virtual to allow for mocking and fakes.
38 class HostListFetcher : public net::URLFetcherDelegate { 40 class HostListFetcher : public net::URLFetcherDelegate {
39 public: 41 public:
40 HostListFetcher(); 42 HostListFetcher();
41 ~HostListFetcher() override; 43 ~HostListFetcher() override;
42 44
43 // Supplied by the client for each hostlist request and returns a valid, 45 // Supplied by the client for each hostlist request and returns a valid,
44 // initialized Hostlist object on success. 46 // initialized Hostlist object on success.
45 typedef base::Callback<void(const std::vector<HostInfo>& hostlist)> 47 typedef base::Callback<void(const std::vector<HostInfo>& hostlist)>
46 HostlistCallback; 48 HostlistCallback;
47 49
48 // Makes a service call to retrieve a hostlist. The 50 // Makes a service call to retrieve a hostlist. The
49 // callback will be called once the HTTP request has completed. 51 // callback will be called once the HTTP request has completed.
50 virtual void RetrieveHostlist(const std::string& access_token, 52 virtual void RetrieveHostlist(const std::string& access_token,
53 const std::string& target_url,
51 const HostlistCallback& callback); 54 const HostlistCallback& callback);
52 55
53 private: 56 private:
54 // Processes the response from the directory service. 57 // Processes the response from the directory service.
55 bool ProcessResponse(std::vector<HostInfo>* hostlist); 58 bool ProcessResponse(std::vector<HostInfo>* hostlist);
56 59
57 // net::URLFetcherDelegate interface. 60 // net::URLFetcherDelegate interface.
58 void OnURLFetchComplete(const net::URLFetcher* source) override; 61 void OnURLFetchComplete(const net::URLFetcher* source) override;
59 62
60 // Holds the URLFetcher for the Host List request. 63 // Holds the URLFetcher for the Host List request.
61 std::unique_ptr<net::URLFetcher> request_; 64 std::unique_ptr<net::URLFetcher> request_;
62 65
63 // Provides application-specific context for the network request. 66 // Provides application-specific context for the network request.
64 scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_; 67 scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_;
65 68
66 // Caller-supplied callback used to return hostlist on success. 69 // Caller-supplied callback used to return hostlist on success.
67 HostlistCallback hostlist_callback_; 70 HostlistCallback hostlist_callback_;
68 71
69 DISALLOW_COPY_AND_ASSIGN(HostListFetcher); 72 DISALLOW_COPY_AND_ASSIGN(HostListFetcher);
70 }; 73 };
71 74
72 } // namespace test 75 } // namespace test
73 } // namespace remoting 76 } // namespace remoting
74 77
75 #endif // REMOTING_TEST_HOST_LIST_FETCHER_H_ 78 #endif // REMOTING_TEST_HOST_LIST_FETCHER_H_
OLDNEW
« no previous file with comments | « remoting/test/fake_host_list_fetcher.cc ('k') | remoting/test/host_list_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698