0

[fuchsia] Update FrameImpl browser tests to use FrameForTest helper.

Bug: 1200314
Change-Id: I6921d7fe355013d5561bfa4bb17976fd9940ec31
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2878803
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885786}
This commit is contained in:
Wez
2021-05-22 15:57:43 +00:00
committed by Chromium LUCI CQ
parent faa7b8f6a5
commit 78fe1a6f2b
4 changed files with 383 additions and 441 deletions

@ -29,6 +29,13 @@ bool LoadUrlAndExpectResponse(
return result->is_response();
}
bool LoadUrlAndExpectResponse(
const fuchsia::web::NavigationControllerPtr& controller,
fuchsia::web::LoadUrlParams params,
base::StringPiece url) {
return LoadUrlAndExpectResponse(controller.get(), std::move(params), url);
}
absl::optional<base::Value> ExecuteJavaScript(fuchsia::web::Frame* frame,
base::StringPiece script) {
base::RunLoop run_loop;

@ -20,6 +20,10 @@ bool LoadUrlAndExpectResponse(
fuchsia::web::NavigationController* navigation_controller,
fuchsia::web::LoadUrlParams load_url_params,
base::StringPiece url);
bool LoadUrlAndExpectResponse(
const fuchsia::web::NavigationControllerPtr& navigation_controller,
fuchsia::web::LoadUrlParams load_url_params,
base::StringPiece url);
// Executes |script| in the context of |frame|'s top-level document.
// Returns an un-set |absl::optional<>| on failure.

File diff suppressed because it is too large Load Diff

@ -40,11 +40,19 @@ class FrameForTest {
// Returns the fuchsia.web.FramePtr owned by this instance.
fuchsia::web::FramePtr& ptr() { return frame_; }
// Provide member-dereference operator to improve test readability by letting
// Frame calls be expressed directly on |this|, rather than via |ptr()|.
fuchsia::web::Frame* operator->() { return frame_.get(); }
// May be called only on non-default-initialized instances, i.e. those
// returned directly, or via move-assignment, from Create().
TestNavigationListener& navigation_listener() {
return *navigation_listener_;
}
fidl::Binding<fuchsia::web::NavigationEventListener>&
navigation_listener_binding() {
return *navigation_listener_binding_;
}
private:
void CreateAndAttachNavigationListener();