blob: 92e4e7364af27b04fa3f2a7a78ab42f9798f6e7a [file] [log] [blame]
// Copyright 2017 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.
module content.mojom;
import "content/public/common/web_preferences.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "skia/public/mojom/bitmap.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";
struct ShellTestConfiguration {
// The current working directory.
mojo_base.mojom.FilePath current_working_directory;
// The temporary directory of the system.
mojo_base.mojom.FilePath temp_path;
// The URL of the current web test.
url.mojom.Url test_url;
// True if tests can open external URLs.
bool allow_external_pages;
// The expected MD5 hash of the pixel results.
string expected_pixel_hash;
// The initial size of the test window.
gfx.mojom.Size initial_size;
// Whether the test is running in protocol mode.
// See TestInfo::protocol_mode in browser/web_test/test_info_extractor.h.
bool protocol_mode;
};
// Results of a CaptureDump call.
struct BlinkTestDump {
// Audio dump.
array<uint8>? audio;
// Layout dump.
string? layout;
// Image dump.
skia.mojom.Bitmap? pixels;
string actual_pixel_hash;
// Selection rect dump.
gfx.mojom.Rect selection_rect;
};
// Blink test messages sent from the browser process to the renderer.
interface BlinkTestControl {
// Sets up a renderer in a window other than the main test window. This may
// be for a window opened by javascript (window.open()) or by the test harness
// (devtools inspector). This should be called as early as possible (as soon
// as a RenderFrame has been created for this interface to be available) after
// the renderer process is created, for each process not tied to the main
// window.
SetupRendererProcessForNonTestWindow();
CaptureDump() => (BlinkTestDump result);
CompositeWithRaster() => ();
// Dumps the frame's contents into a string.
DumpFrameLayout() => (string frame_layout_dump);
// Replicates test config (for an already started test) to a new renderer
// that hosts parts of the main test window.
ReplicateTestConfiguration(ShellTestConfiguration config);
// Sets the test config for a web test that is being started. This message
// is sent only to a renderer that hosts parts of the main test window.
SetTestConfiguration(ShellTestConfiguration config);
// Tells the renderer to navigate to about:blank and reset all state
// in preparation for the next test. This happens before leak detection
// in order for the test harness to drop anything that tests passed in
// and which could cause a leak otherwise.
ResetRendererAfterWebTest();
// Tells the main window that a secondary renderer in a different process
// asked to finish the test.
FinishTestInMainWindow();
// Notifies BlinkTestRunner that the layout dump has completed (and that it
// can proceed with finishing up the test).
// TODO(crbug.com/1039247): This message should be removed and the callback
// should happen part of LayoutDump call on the host interface.
LayoutDumpCompleted(string completed_layout_dump);
// Reply Bluetooth manual events to BlinkTestRunner.
ReplyBluetoothManualChooserEvents(array<string> events);
};
// Blink test messages sent from the renderer process to the browser.
interface BlinkTestClient {
// Asks the browser process to perform a layout dump spanning all the
// (potentially cross-process) frames. This goes through multiple
// BlinkTestControl.DumpFrameLayout calls and ends with sending of
// LayoutDumpCompleted of BlinkTestControl interface.
InitiateLayoutDump();
// Initialize to dump the main window's navigation history to text, and/or
// capture a pixel dump of the main window's content.
InitiateCaptureDump(bool capture_navigation_history, bool capture_pixels);
// Sent by secondary test window to notify the test has finished.
TestFinishedInSecondaryRenderer();
// An ACK to notify the browser process that ResetRendererAfterWebTest() has
// completed.
ResetRendererAfterWebTestDone();
// Add a message to stderr (not saved to expected output files, for debugging
// only).
PrintMessageToStderr(string message);
// Add a message.
PrintMessage(string message);
// Update changed WebKit preferences.
OverridePreferences(WebPreferences web_preferences);
// Trigger a reload navigation on the main WebView.
Reload();
// Invoked when the embedder should close all but the main WebView.
CloseRemainingWindows();
// Trigger a GoToOffset navigation on the main WebView.
GoToOffset(int32 offset);
// Calls the BluetoothChooser::EventHandler with the arguments here. Valid
// event strings are:
// * "cancel" - simulates the user canceling the chooser.
// * "select" - simulates the user selecting a device whose device ID is in
// |argument|.
SendBluetoothManualChooserEvent(string event, string argument);
// If |enable| is true makes the Bluetooth chooser record its input and wait
// for instructions from the test program on how to proceed. Otherwise
// fall backs to the browser's default chooser.
SetBluetoothManualChooser(bool enable);
// Returns the events recorded since the last call to this function.
GetBluetoothManualChooserEvents();
// Manages the popup blocking setting to used for web tests.
SetPopupBlockingEnabled(bool block_popups);
// Trigger a loadURL navigation on the main WebView.
LoadURLForFrame(url.mojom.Url url, string frame_name);
// Mark the orientation changed in the browser process for the layout tests
// that request fullscreen on screen orientation change.
SetScreenOrientationChanged();
// Sets the cookie policy to:
// - allow all cookies when |block| is false
// - block only third-party cookies when |block| is true
BlockThirdPartyCookies(bool block);
// Returns the absolute path to a directory this test can write data in. This
// returns the path to a fresh empty directory for each test that calls this
// method, but repeatedly calling this from the same test will return the same
// directory.
[Sync]
GetWritableDirectory() => (mojo_base.mojom.FilePath path);
// For the duration of the current test this causes all file choosers to
// return the passed in |path|.
SetFilePathForMockFileDialog(mojo_base.mojom.FilePath path);
};