Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / remoting / test / fake_app_remoting_report_issue_request.cc
blob8d628c9448d1085bc5652b2a37e3e44358437e73
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 #include "remoting/test/fake_app_remoting_report_issue_request.h"
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h"
10 #include "base/time/time.h"
12 namespace remoting {
13 namespace test {
15 std::string MakeFormattedStringForReleasedHost(
16 const std::string& application_id,
17 const std::string& host_id) {
18 return application_id + "::" + host_id;
21 FakeAppRemotingReportIssueRequest::FakeAppRemotingReportIssueRequest()
22 : fail_start_request_(false) {
25 FakeAppRemotingReportIssueRequest::~FakeAppRemotingReportIssueRequest() {
28 bool FakeAppRemotingReportIssueRequest::Start(
29 const std::string& application_id,
30 const std::string& host_id,
31 const std::string& access_token,
32 ServiceEnvironment service_environment,
33 bool abandon_host,
34 base::Closure done_callback) {
35 if (fail_start_request_) {
36 done_callback.Run();
37 return false;
40 if (abandon_host) {
41 std::string host_id_string(application_id + "::" + host_id);
42 host_ids_released_.push_back(MakeFormattedStringForReleasedHost(
43 application_id, host_id));
46 scoped_refptr<base::SingleThreadTaskRunner> task_runner =
47 base::ThreadTaskRunnerHandle::Get();
48 task_runner->PostTask(FROM_HERE, done_callback);
50 return true;
53 } // namespace test
54 } // namespace remoting