blob: b681ede37d89af99fc9bf967bc6f6e7ff2848ef2 [file] [log] [blame]
Kevin McNee5994d732025-03-26 15:55:371// Copyright 2025 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
5#ifndef CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_
6#define CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_
7
David Bokan841259332025-04-14 21:24:448#include <optional>
Jason Chasec037459e2025-04-09 00:53:449#include <string_view>
10
David Bokanf64ca03e2025-04-22 21:21:0411#include "base/time/time.h"
Kevin McNee5994d732025-03-26 15:55:3712#include "components/optimization_guide/proto/features/actions_data.pb.h"
David Bokanc4f1aea2025-04-16 14:02:1713#include "ui/gfx/geometry/point.h"
Kevin McNee5994d732025-03-26 15:55:3714
David Bokan841259332025-04-14 21:24:4415namespace content {
16class RenderFrameHost;
17} // namespace content
18
Kevin McNee5994d732025-03-26 15:55:3719namespace actor {
20
21optimization_guide::proto::BrowserAction MakeClick(int content_node_id);
David Bokana7da0672025-04-01 02:51:4122optimization_guide::proto::BrowserAction MakeHistoryBack();
23optimization_guide::proto::BrowserAction MakeHistoryForward();
Rodney Dinga8548d52025-04-01 13:03:5924optimization_guide::proto::BrowserAction MakeMouseMove(int content_node_id);
Jason Chasec037459e2025-04-09 00:53:4425optimization_guide::proto::BrowserAction MakeNavigate(
26 std::string_view target_url);
Rodney Ding182593f92025-04-08 18:33:1327optimization_guide::proto::BrowserAction MakeType(int content_node_id,
28 std::string_view text,
29 bool follow_by_enter);
David Bokan647b3ba62025-04-15 20:27:2330optimization_guide::proto::BrowserAction MakeSelect(int content_node_id,
31 std::string_view value);
32
Lan Wei4bf7d0b2025-04-08 21:59:1133optimization_guide::proto::BrowserAction MakeScroll(
34 std::optional<int> content_node_id,
35 float scroll_offset_x,
36 float scroll_offset_y);
David Bokanc4f1aea2025-04-16 14:02:1737optimization_guide::proto::BrowserAction MakeDragAndRelease(
38 const gfx::Point& from_point,
39 const gfx::Point& to_point);
Kevin McNee5994d732025-03-26 15:55:3740
David Bokan841259332025-04-14 21:24:4441// Returns the DOMNodeId of the node matched by the given CSS query selector.
42std::optional<int> FindContentNodeId(content::RenderFrameHost& rfh,
43 std::string_view query_selector);
44
David Bokanf64ca03e2025-04-22 21:21:0445void OverrideActionObservationDelay(const base::TimeDelta& delta);
46
Kevin McNee5994d732025-03-26 15:55:3747} // namespace actor
48
49#endif // CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_