diff options
author | joedow <joedow@chromium.org> | 2015-07-01 18:39:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-02 01:39:48 +0000 |
commit | 751a18f30665e8cc19bc5abcd304e550f99fde48 (patch) | |
tree | eac849d5bc7dfa4b0149ba995a0367cf8e86e249 /remoting/test/fake_app_remoting_report_issue_request.h | |
parent | b8827395a72e786259c24806fcc0f5827e2a88c5 (diff) | |
download | chromium_src-751a18f30665e8cc19bc5abcd304e550f99fde48.zip chromium_src-751a18f30665e8cc19bc5abcd304e550f99fde48.tar.gz chromium_src-751a18f30665e8cc19bc5abcd304e550f99fde48.tar.bz2 |
Adding the ability to release hosts after testing to the app remoting test driver.
This change introduces a new class which will wrap calls to the
ReportIssue API. This request will be used to tell the service when we
are done with the remote hosts we used for testing so that they can be
cleaned up and the test will receive a fresh instance the next time it
is launched. I've also moved the logic to create the service urls out
into a separate class which can be used by framework and unit test
code.
Also updates the behavior for 'show-host-availability' so that it can be
used when running tests for debugging info purposes.
Also cleans up some minor cpplint errors.
BUG=
Review URL: https://codereview.chromium.org/1219063002
Cr-Commit-Position: refs/heads/master@{#337155}
Diffstat (limited to 'remoting/test/fake_app_remoting_report_issue_request.h')
-rw-r--r-- | remoting/test/fake_app_remoting_report_issue_request.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/remoting/test/fake_app_remoting_report_issue_request.h b/remoting/test/fake_app_remoting_report_issue_request.h new file mode 100644 index 0000000..2502040 --- /dev/null +++ b/remoting/test/fake_app_remoting_report_issue_request.h @@ -0,0 +1,58 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_ +#define REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_ + +#include <string> +#include <vector> + +#include "remoting/test/app_remoting_report_issue_request.h" + +namespace remoting { +namespace test { + +// Generates a string used to track the 'released' host id by the +// FakeAppRemotingReportIssueRequest class. +std::string MakeFormattedStringForReleasedHost( + const std::string& application_id, + const std::string& host_id); + +// Used for testing classes which rely on the AccessTokenFetcher and want to +// simulate success and failure scenarios without using the actual class and +// network connection. +class FakeAppRemotingReportIssueRequest : public AppRemotingReportIssueRequest { + public: + FakeAppRemotingReportIssueRequest(); + ~FakeAppRemotingReportIssueRequest() override; + + // AppRemotingReportIssueRequest interface. + bool Start(const std::string& application_id, + const std::string& host_id, + const std::string& access_token, + ServiceEnvironment service_environment, + bool abandon_host, + base::Closure done_callback) override; + + void set_fail_start_request(bool fail) { fail_start_request_ = fail; } + + const std::vector<std::string>& get_host_ids_released() { + return host_ids_released_; + } + + private: + // True if Start() should fail. + bool fail_start_request_; + + // Contains the set of host ids which have been released, the string contained + // will be in the form "<application_id>::<host_id>"; + std::vector<std::string> host_ids_released_; + + DISALLOW_COPY_AND_ASSIGN(FakeAppRemotingReportIssueRequest); +}; + +} // namespace test +} // namespace remoting + +#endif // REMOTING_TEST_FAKE_APP_REMOTING_REPORT_ISSUE_REQUEST_H_ |