| Index: chrome/browser/webshare/share_service_impl_unittest.cc
|
| diff --git a/chrome/browser/webshare/share_service_impl_unittest.cc b/chrome/browser/webshare/share_service_impl_unittest.cc
|
| index aba1777552e1fd0b1c3aa87d8fc192e86c0d43dc..0e6eaf5657dc9ee0e68d4d11a0548bfc2096ea51 100644
|
| --- a/chrome/browser/webshare/share_service_impl_unittest.cc
|
| +++ b/chrome/browser/webshare/share_service_impl_unittest.cc
|
| @@ -32,11 +32,22 @@ class ShareServiceTestImpl : public ShareServiceImpl {
|
| return share_service_helper_raw;
|
| }
|
|
|
| + void set_picker_result(SharePickerResult result) {
|
| + picker_result_ = result;
|
| + }
|
| +
|
| const std::string& GetLastUsedTargetURL() { return last_used_target_url_; }
|
|
|
| private:
|
| + SharePickerResult picker_result_ = SharePickerResult::SHARE;
|
| std::string last_used_target_url_;
|
|
|
| + void ShowPickerDialog(
|
| + const std::vector<base::string16>& targets,
|
| + const base::Callback<void(SharePickerResult)>& callback) override {
|
| + callback.Run(picker_result_);
|
| + }
|
| +
|
| void OpenTargetURL(const GURL& target_url) override {
|
| last_used_target_url_ = target_url.spec();
|
| }
|
| @@ -95,6 +106,26 @@ TEST_F(ShareServiceImplUnittest, ShareCallbackParams) {
|
| run_loop.Run();
|
| }
|
|
|
| +// Tests the result of cancelling the share in the picker UI.
|
| +TEST_F(ShareServiceImplUnittest, ShareCancel) {
|
| + // Ask that the dialog be cancelled.
|
| + share_service_helper_->set_picker_result(SharePickerResult::CANCEL);
|
| +
|
| + // Expect an error message in response.
|
| + base::Callback<void(const base::Optional<std::string>&)> callback =
|
| + base::Bind(&ShareServiceImplUnittest::DidShare, base::Unretained(this),
|
| + std::string(),
|
| + base::Optional<std::string>("Share was cancelled"));
|
| +
|
| + base::RunLoop run_loop;
|
| + on_callback_ = run_loop.QuitClosure();
|
| +
|
| + const GURL url(kUrlSpec);
|
| + share_service_->Share(kTitle, kText, url, callback);
|
| +
|
| + run_loop.Run();
|
| +}
|
| +
|
| // Replace various numbers of placeholders in various orders. Placeholders are
|
| // adjacent to eachother; there are no padding characters.
|
| TEST_F(ShareServiceImplUnittest, ReplacePlaceholders) {
|
|
|