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