Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 1 | // 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. foltz | a48aecb | 2025-05-09 21:58:35 | [diff] [blame] | 8 | #include "base/test/test_future.h" |
David Bokan | f64ca03e | 2025-04-22 21:21:04 | [diff] [blame] | 9 | #include "base/time/time.h" |
mark a. foltz | a48aecb | 2025-05-09 21:58:35 | [diff] [blame] | 10 | #include "chrome/common/actor.mojom-forward.h" |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 11 | #include "components/optimization_guide/proto/features/actions_data.pb.h" |
David Bokan | c4f1aea | 2025-04-16 14:02:17 | [diff] [blame] | 12 | #include "ui/gfx/geometry/point.h" |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 13 | |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 14 | namespace content { |
| 15 | class RenderFrameHost; |
| 16 | } // namespace content |
| 17 | |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 18 | namespace actor { |
| 19 | |
Rodney Ding | d273338 | 2025-05-15 17:42:51 | [diff] [blame] | 20 | optimization_guide::proto::BrowserAction MakeClick( |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 21 | content::RenderFrameHost& rfh, |
| 22 | int content_node_id); |
| 23 | optimization_guide::proto::BrowserAction MakeClick( |
| 24 | content::RenderFrameHost& rfh, |
Rodney Ding | d273338 | 2025-05-15 17:42:51 | [diff] [blame] | 25 | const gfx::Point& click_point); |
David Bokan | a7da067 | 2025-04-01 02:51:41 | [diff] [blame] | 26 | optimization_guide::proto::BrowserAction MakeHistoryBack(); |
| 27 | optimization_guide::proto::BrowserAction MakeHistoryForward(); |
Rodney Ding | 33b5bffe | 2025-05-15 17:43:25 | [diff] [blame] | 28 | optimization_guide::proto::BrowserAction MakeMouseMove( |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 29 | content::RenderFrameHost& rfh, |
| 30 | int content_node_id); |
| 31 | optimization_guide::proto::BrowserAction MakeMouseMove( |
| 32 | content::RenderFrameHost& rfh, |
Rodney Ding | 33b5bffe | 2025-05-15 17:43:25 | [diff] [blame] | 33 | const gfx::Point& move_point); |
Jason Chase | c037459e | 2025-04-09 00:53:44 | [diff] [blame] | 34 | optimization_guide::proto::BrowserAction MakeNavigate( |
| 35 | std::string_view target_url); |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 36 | optimization_guide::proto::BrowserAction MakeType(content::RenderFrameHost& rfh, |
| 37 | int content_node_id, |
Rodney Ding | 182593f9 | 2025-04-08 18:33:13 | [diff] [blame] | 38 | std::string_view text, |
| 39 | bool follow_by_enter); |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 40 | optimization_guide::proto::BrowserAction MakeType(content::RenderFrameHost& rfh, |
| 41 | const gfx::Point& type_point, |
Rodney Ding | 0fb8cb6 | 2025-05-20 19:58:11 | [diff] [blame] | 42 | std::string_view text, |
| 43 | bool follow_by_enter); |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 44 | optimization_guide::proto::BrowserAction MakeSelect( |
| 45 | content::RenderFrameHost& rfh, |
| 46 | int content_node_id, |
| 47 | std::string_view value); |
David Bokan | 647b3ba6 | 2025-04-15 20:27:23 | [diff] [blame] | 48 | |
Lan Wei | 4bf7d0b | 2025-04-08 21:59:11 | [diff] [blame] | 49 | optimization_guide::proto::BrowserAction MakeScroll( |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 50 | content::RenderFrameHost& rfh, |
Lan Wei | 4bf7d0b | 2025-04-08 21:59:11 | [diff] [blame] | 51 | std::optional<int> content_node_id, |
| 52 | float scroll_offset_x, |
| 53 | float scroll_offset_y); |
David Bokan | c4f1aea | 2025-04-16 14:02:17 | [diff] [blame] | 54 | optimization_guide::proto::BrowserAction MakeDragAndRelease( |
David Bokan | ad90a58 | 2025-05-23 14:30:45 | [diff] [blame] | 55 | content::RenderFrameHost& rfh, |
David Bokan | c4f1aea | 2025-04-16 14:02:17 | [diff] [blame] | 56 | const gfx::Point& from_point, |
| 57 | const gfx::Point& to_point); |
Kevin McNee | 2ff058f | 2025-04-23 03:00:02 | [diff] [blame] | 58 | optimization_guide::proto::BrowserAction MakeWait(); |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 59 | |
David Bokan | f64ca03e | 2025-04-22 21:21:04 | [diff] [blame] | 60 | void OverrideActionObservationDelay(const base::TimeDelta& delta); |
| 61 | |
mark a. foltz | a48aecb | 2025-05-09 21:58:35 | [diff] [blame] | 62 | void ExpectOkResult(base::test::TestFuture<mojom::ActionResultPtr>& future); |
| 63 | void ExpectErrorResult(base::test::TestFuture<mojom::ActionResultPtr>& future, |
| 64 | mojom::ActionResultCode expected_code); |
| 65 | |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 66 | } // namespace actor |
| 67 | |
| 68 | #endif // CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_ |