blob: 9db257c4905358c479e0581e65e7540bc0f74242 [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
mark a. foltza48aecb2025-05-09 21:58:358#include "base/test/test_future.h"
David Bokanf64ca03e2025-04-22 21:21:049#include "base/time/time.h"
mark a. foltza48aecb2025-05-09 21:58:3510#include "chrome/common/actor.mojom-forward.h"
Kevin McNee5994d732025-03-26 15:55:3711#include "components/optimization_guide/proto/features/actions_data.pb.h"
David Bokanc4f1aea2025-04-16 14:02:1712#include "ui/gfx/geometry/point.h"
Kevin McNee5994d732025-03-26 15:55:3713
David Bokanad90a582025-05-23 14:30:4514namespace content {
15class RenderFrameHost;
16} // namespace content
17
Kevin McNee5994d732025-03-26 15:55:3718namespace actor {
19
Rodney Dingd2733382025-05-15 17:42:5120optimization_guide::proto::BrowserAction MakeClick(
David Bokanad90a582025-05-23 14:30:4521 content::RenderFrameHost& rfh,
22 int content_node_id);
23optimization_guide::proto::BrowserAction MakeClick(
24 content::RenderFrameHost& rfh,
Rodney Dingd2733382025-05-15 17:42:5125 const gfx::Point& click_point);
David Bokana7da0672025-04-01 02:51:4126optimization_guide::proto::BrowserAction MakeHistoryBack();
27optimization_guide::proto::BrowserAction MakeHistoryForward();
Rodney Ding33b5bffe2025-05-15 17:43:2528optimization_guide::proto::BrowserAction MakeMouseMove(
David Bokanad90a582025-05-23 14:30:4529 content::RenderFrameHost& rfh,
30 int content_node_id);
31optimization_guide::proto::BrowserAction MakeMouseMove(
32 content::RenderFrameHost& rfh,
Rodney Ding33b5bffe2025-05-15 17:43:2533 const gfx::Point& move_point);
Jason Chasec037459e2025-04-09 00:53:4434optimization_guide::proto::BrowserAction MakeNavigate(
35 std::string_view target_url);
David Bokanad90a582025-05-23 14:30:4536optimization_guide::proto::BrowserAction MakeType(content::RenderFrameHost& rfh,
37 int content_node_id,
Rodney Ding182593f92025-04-08 18:33:1338 std::string_view text,
39 bool follow_by_enter);
David Bokanad90a582025-05-23 14:30:4540optimization_guide::proto::BrowserAction MakeType(content::RenderFrameHost& rfh,
41 const gfx::Point& type_point,
Rodney Ding0fb8cb62025-05-20 19:58:1142 std::string_view text,
43 bool follow_by_enter);
David Bokanad90a582025-05-23 14:30:4544optimization_guide::proto::BrowserAction MakeSelect(
45 content::RenderFrameHost& rfh,
46 int content_node_id,
47 std::string_view value);
David Bokan647b3ba62025-04-15 20:27:2348
Lan Wei4bf7d0b2025-04-08 21:59:1149optimization_guide::proto::BrowserAction MakeScroll(
David Bokanad90a582025-05-23 14:30:4550 content::RenderFrameHost& rfh,
Lan Wei4bf7d0b2025-04-08 21:59:1151 std::optional<int> content_node_id,
52 float scroll_offset_x,
53 float scroll_offset_y);
David Bokanc4f1aea2025-04-16 14:02:1754optimization_guide::proto::BrowserAction MakeDragAndRelease(
David Bokanad90a582025-05-23 14:30:4555 content::RenderFrameHost& rfh,
David Bokanc4f1aea2025-04-16 14:02:1756 const gfx::Point& from_point,
57 const gfx::Point& to_point);
Kevin McNee2ff058f2025-04-23 03:00:0258optimization_guide::proto::BrowserAction MakeWait();
Kevin McNee5994d732025-03-26 15:55:3759
David Bokanf64ca03e2025-04-22 21:21:0460void OverrideActionObservationDelay(const base::TimeDelta& delta);
61
mark a. foltza48aecb2025-05-09 21:58:3562void ExpectOkResult(base::test::TestFuture<mojom::ActionResultPtr>& future);
63void ExpectErrorResult(base::test::TestFuture<mojom::ActionResultPtr>& future,
64 mojom::ActionResultCode expected_code);
65
Kevin McNee5994d732025-03-26 15:55:3766} // namespace actor
67
68#endif // CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_