Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / test / fake_app_remoting_report_issue_request.h
blob250204061dffdfad22b6b66d018aedafdcabd5e7
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
6 #define REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_
8 #include <string>
9 #include <vector>
11 #include "remoting/test/app_remoting_report_issue_request.h"
13 namespace remoting {
14 namespace test {
16 // Generates a string used to track the 'released' host id by the
17 // FakeAppRemotingReportIssueRequest class.
18 std::string MakeFormattedStringForReleasedHost(
19 const std::string& application_id,
20 const std::string& host_id);
22 // Used for testing classes which rely on the AccessTokenFetcher and want to
23 // simulate success and failure scenarios without using the actual class and
24 // network connection.
25 class FakeAppRemotingReportIssueRequest : public AppRemotingReportIssueRequest {
26 public:
27 FakeAppRemotingReportIssueRequest();
28 ~FakeAppRemotingReportIssueRequest() override;
30 // AppRemotingReportIssueRequest interface.
31 bool Start(const std::string& application_id,
32 const std::string& host_id,
33 const std::string& access_token,
34 ServiceEnvironment service_environment,
35 bool abandon_host,
36 base::Closure done_callback) override;
38 void set_fail_start_request(bool fail) { fail_start_request_ = fail; }
40 const std::vector<std::string>& get_host_ids_released() {
41 return host_ids_released_;
44 private:
45 // True if Start() should fail.
46 bool fail_start_request_;
48 // Contains the set of host ids which have been released, the string contained
49 // will be in the form "<application_id>::<host_id>";
50 std::vector<std::string> host_ids_released_;
52 DISALLOW_COPY_AND_ASSIGN(FakeAppRemotingReportIssueRequest);
55 } // namespace test
56 } // namespace remoting
58 #endif // REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_