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

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

Issue 1008043003: Adding Test Fixture for initial test cases for the App Remoting Test Driver. Also includes the pub… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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_REMOTE_HOST_INFO_FETCHER_H_ 5 #ifndef REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_
6 #define REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_ 6 #define REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 18 matching lines...) Expand all
29 "https://www-googleapis-test.sandbox.google.com/appremoting/v1beta1_dev/" 29 "https://www-googleapis-test.sandbox.google.com/appremoting/v1beta1_dev/"
30 "applications/%s/run"; 30 "applications/%s/run";
31 const char kTestServiceEnvironmentUrlFormat[] = 31 const char kTestServiceEnvironmentUrlFormat[] =
32 "https://www-googleapis-test.sandbox.google.com/appremoting/v1beta1/" 32 "https://www-googleapis-test.sandbox.google.com/appremoting/v1beta1/"
33 "applications/%s/run"; 33 "applications/%s/run";
34 34
35 // Specifies the service API to call for app remoting host information. 35 // Specifies the service API to call for app remoting host information.
36 // Note: When adding new environments, add them before kUnknownEnvironment as 36 // Note: When adding new environments, add them before kUnknownEnvironment as
37 // the last entry is used for bounds checking. 37 // the last entry is used for bounds checking.
38 enum ServiceEnvironment { 38 enum ServiceEnvironment {
39 kDeveloperEnvironment, 39 kDeveloperEnvironment,
40 kTestingEnvironment, 40 kTestingEnvironment,
41 kUnknownEnvironment 41 kUnknownEnvironment
42 }; 42 };
43 43
44 // Supplied by the client for each remote host info request and returns a valid, 44 // Supplied by the client for each remote host info request and returns a valid,
45 // initialized RemoteHostInfo object on success. 45 // initialized RemoteHostInfo object on success.
46 typedef base::Callback<void(const RemoteHostInfo& remote_host_info)> 46 typedef base::Callback<void(const RemoteHostInfo& remote_host_info)>
47 RemoteHostInfoCallback; 47 RemoteHostInfoCallback;
48 48
49 // Calls the App Remoting service API to request connection info for a remote 49 // Calls the App Remoting service API to request connection info for a remote
50 // host. Destroying the RemoteHostInfoFetcher while a request is outstanding 50 // host. Destroying the RemoteHostInfoFetcher while a request is outstanding
51 // will cancel the request. It is safe to delete the fetcher from within a 51 // will cancel the request. It is safe to delete the fetcher from within a
52 // completion callback. Must be used from a thread running an IO message loop. 52 // completion callback. Must be used from a thread running an IO message loop.
53 // The public method is virtual to allow for mocking and fakes. 53 // The public method is virtual to allow for mocking and fakes.
54 class RemoteHostInfoFetcher : public net::URLFetcherDelegate { 54 class RemoteHostInfoFetcher : public net::URLFetcherDelegate {
55 public: 55 public:
56 RemoteHostInfoFetcher(); 56 RemoteHostInfoFetcher();
57 ~RemoteHostInfoFetcher() override; 57 ~RemoteHostInfoFetcher() override;
58 58
59 // Makes a service call to retrieve the details for a remote host. The 59 // Makes a service call to retrieve the details for a remote host. The
60 // callback will be called once the HTTP request has completed. 60 // callback will be called once the HTTP request has completed.
61 virtual bool RetrieveRemoteHostInfo( 61 virtual bool RetrieveRemoteHostInfo(const std::string& application_id,
62 const std::string& application_id, 62 const std::string& access_token,
63 const std::string& access_token, 63 ServiceEnvironment service_environment,
64 ServiceEnvironment service_environment, 64 const RemoteHostInfoCallback& callback);
65 const RemoteHostInfoCallback& callback);
66 65
67 private: 66 private:
68 // net::URLFetcherDelegate interface. 67 // net::URLFetcherDelegate interface.
69 void OnURLFetchComplete(const net::URLFetcher* source) override; 68 void OnURLFetchComplete(const net::URLFetcher* source) override;
70 69
71 // Holds the URLFetcher for the RemoteHostInfo request. 70 // Holds the URLFetcher for the RemoteHostInfo request.
72 scoped_ptr<net::URLFetcher> request_; 71 scoped_ptr<net::URLFetcher> request_;
73 72
73 // Provides application-specific context for the network request.
74 scoped_refptr<remoting::URLRequestContextGetter> request_context_getter_;
75
74 // Caller-supplied callback used to return remote host info on success. 76 // Caller-supplied callback used to return remote host info on success.
75 RemoteHostInfoCallback remote_host_info_callback_; 77 RemoteHostInfoCallback remote_host_info_callback_;
76 78
77 DISALLOW_COPY_AND_ASSIGN(RemoteHostInfoFetcher); 79 DISALLOW_COPY_AND_ASSIGN(RemoteHostInfoFetcher);
78 }; 80 };
79 81
80 } // namespace test 82 } // namespace test
81 } // namespace remoting 83 } // namespace remoting
82 84
83 #endif // REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_ 85 #endif // REMOTING_TEST_REMOTE_HOST_INFO_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698