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 | |
David Bokan | 84125933 | 2025-04-14 21:24:44 | [diff] [blame] | 8 | #include <optional> |
Jason Chase | c037459e | 2025-04-09 00:53:44 | [diff] [blame] | 9 | #include <string_view> |
| 10 | |
David Bokan | f64ca03e | 2025-04-22 21:21:04 | [diff] [blame^] | 11 | #include "base/time/time.h" |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 12 | #include "components/optimization_guide/proto/features/actions_data.pb.h" |
David Bokan | c4f1aea | 2025-04-16 14:02:17 | [diff] [blame] | 13 | #include "ui/gfx/geometry/point.h" |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 14 | |
David Bokan | 84125933 | 2025-04-14 21:24:44 | [diff] [blame] | 15 | namespace content { |
| 16 | class RenderFrameHost; |
| 17 | } // namespace content |
| 18 | |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 19 | namespace actor { |
| 20 | |
| 21 | optimization_guide::proto::BrowserAction MakeClick(int content_node_id); |
David Bokan | a7da067 | 2025-04-01 02:51:41 | [diff] [blame] | 22 | optimization_guide::proto::BrowserAction MakeHistoryBack(); |
| 23 | optimization_guide::proto::BrowserAction MakeHistoryForward(); |
Rodney Ding | a8548d5 | 2025-04-01 13:03:59 | [diff] [blame] | 24 | optimization_guide::proto::BrowserAction MakeMouseMove(int content_node_id); |
Jason Chase | c037459e | 2025-04-09 00:53:44 | [diff] [blame] | 25 | optimization_guide::proto::BrowserAction MakeNavigate( |
| 26 | std::string_view target_url); |
Rodney Ding | 182593f9 | 2025-04-08 18:33:13 | [diff] [blame] | 27 | optimization_guide::proto::BrowserAction MakeType(int content_node_id, |
| 28 | std::string_view text, |
| 29 | bool follow_by_enter); |
David Bokan | 647b3ba6 | 2025-04-15 20:27:23 | [diff] [blame] | 30 | optimization_guide::proto::BrowserAction MakeSelect(int content_node_id, |
| 31 | std::string_view value); |
| 32 | |
Lan Wei | 4bf7d0b | 2025-04-08 21:59:11 | [diff] [blame] | 33 | optimization_guide::proto::BrowserAction MakeScroll( |
| 34 | std::optional<int> content_node_id, |
| 35 | float scroll_offset_x, |
| 36 | float scroll_offset_y); |
David Bokan | c4f1aea | 2025-04-16 14:02:17 | [diff] [blame] | 37 | optimization_guide::proto::BrowserAction MakeDragAndRelease( |
| 38 | const gfx::Point& from_point, |
| 39 | const gfx::Point& to_point); |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 40 | |
David Bokan | 84125933 | 2025-04-14 21:24:44 | [diff] [blame] | 41 | // Returns the DOMNodeId of the node matched by the given CSS query selector. |
| 42 | std::optional<int> FindContentNodeId(content::RenderFrameHost& rfh, |
| 43 | std::string_view query_selector); |
| 44 | |
David Bokan | f64ca03e | 2025-04-22 21:21:04 | [diff] [blame^] | 45 | void OverrideActionObservationDelay(const base::TimeDelta& delta); |
| 46 | |
Kevin McNee | 5994d73 | 2025-03-26 15:55:37 | [diff] [blame] | 47 | } // namespace actor |
| 48 | |
| 49 | #endif // CHROME_BROWSER_ACTOR_ACTOR_TEST_UTIL_H_ |