blob: 20534eaf5e92edb75fb960adf8b2dbc2ee86e979 [file] [log] [blame]
// Copyright 2019 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.
#include <fuchsia/web/cpp/fidl.h>
#include "base/optional.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
namespace cr_fuchsia {
// Uses |navigation_controller| to load |url| with |load_url_params|. Returns
// after the load is completed. Returns true if the load was successful, false
// otherwise.
bool LoadUrlAndExpectResponse(
fuchsia::web::NavigationController* 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 |base::Optional<>| on failure.
base::Optional<base::Value> ExecuteJavaScript(fuchsia::web::Frame* frame,
base::StringPiece script);
// Creates and returns a LoadUrlParams with was_user_activated set to true.
// This allows user actions to propagate to the frame, allowing features such as
// autoplay to be used, which is used by many media tests.
fuchsia::web::LoadUrlParams CreateLoadUrlParamsWithUserActivation();
// Creates a WebMessage with one outgoing transferable set to
// |message_port_request| and data set to |buffer|.
fuchsia::web::WebMessage CreateWebMessageWithMessagePortRequest(
fidl::InterfaceRequest<fuchsia::web::MessagePort> message_port_request,
fuchsia::mem::Buffer buffer);
} // namespace cr_fuchsia