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

Unified Diff: chrome/browser/webshare/share_service_impl_unittest.cc

Issue 2667803002: Picker takes a vector of pairs, and passes back the user chosen target. (Closed)
Patch Set: Move replacing of placeholders to after picker Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
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 0e6eaf5657dc9ee0e68d4d11a0548bfc2096ea51..1bf936b8c40a389d7b0fc6fc6d2c78337cc2d8a8 100644
--- a/chrome/browser/webshare/share_service_impl_unittest.cc
+++ b/chrome/browser/webshare/share_service_impl_unittest.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/run_loop.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/webshare/share_service_impl.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "mojo/public/cpp/bindings/interface_request.h"
@@ -32,19 +33,20 @@ class ShareServiceTestImpl : public ShareServiceImpl {
return share_service_helper_raw;
}
- void set_picker_result(SharePickerResult result) {
+ void set_picker_result(base::Optional<base::string16> result) {
picker_result_ = result;
}
const std::string& GetLastUsedTargetURL() { return last_used_target_url_; }
private:
- SharePickerResult picker_result_ = SharePickerResult::SHARE;
+ base::Optional<base::string16> picker_result_ = base::nullopt;
std::string last_used_target_url_;
void ShowPickerDialog(
const std::vector<base::string16>& targets,
- const base::Callback<void(SharePickerResult)>& callback) override {
+ const base::Callback<void(base::Optional<base::string16>)>& callback)
+ override {
callback.Run(picker_result_);
}
@@ -92,6 +94,8 @@ TEST_F(ShareServiceImplUnittest, ShareCallbackParams) {
"https://wicg.github.io/web-share-target/demos/"
"sharetarget.html?title=My%20title&text=My%20text&url=https%3A%2F%2Fwww."
"google.com%2F";
+ share_service_helper_->set_picker_result(
+ base::ASCIIToUTF16("https://wicg.github.io/web-share-target/demos/"));
const GURL url(kUrlSpec);
base::Callback<void(const base::Optional<std::string>&)> callback =
@@ -109,7 +113,7 @@ TEST_F(ShareServiceImplUnittest, ShareCallbackParams) {
// 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);
+ share_service_helper_->set_picker_result(base::nullopt);
// Expect an error message in response.
base::Callback<void(const base::Optional<std::string>&)> callback =

Powered by Google App Engine
This is Rietveld 408576698