1# Copyright 2024 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5from __future__ import annotations 6 7import enum 8 9from crossbench.config import ConfigEnum 10 11 12@enum.unique 13class ButtonClick(ConfigEnum): 14 LEFT = ("left", "Press left mouse button") 15 RIGHT = ("right", "Press right mouse button") 16 MIDDLE = ("middle", "Press middle mouse button") 17 18 19@enum.unique 20class ReadyState(ConfigEnum): 21 """See https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState""" 22 # Non-blocking: 23 ANY = ("any", "Ignore ready state") 24 # Blocking (on dom event): 25 LOADING = ("loading", "The document is still loading.") 26 INTERACTIVE = ("interactive", "The document has finished loading " 27 "but sub-resources might still be loading") 28 COMPLETE = ("complete", 29 "The document and all sub-resources have finished loading.") 30 31 32@enum.unique 33class WindowTarget(ConfigEnum): 34 """See https://developer.mozilla.org/en-US/docs/Web/API/Window/open""" 35 # TODO: pull this out to the browsers and use this enum instead of the strings 36 # in the browser show_url implementations. 37 SELF = ("_self", "The current browsing context. (Default)") 38 BLANK = ("_blank", "Usually a new tab, but users can configure browsers " 39 "to open a new window instead.") 40 PARENT = ("_parent", "The parent browsing context of the current one. " 41 "If no parent, behaves as _self.") 42 TOP = ("_top", "The topmost browsing context " 43 "(the 'highest' context that's an ancestor of the current one). " 44 "If no ancestors, behaves as _self.") 45 # The following options are Crossbench specific and are not understoon by the 46 # underlying call to window.open() in JS. 47 NEW_TAB = ("_new_tab", "A new tab.") 48 NEW_WINDOW = ("_new_window", "A new window.") 49