OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
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_TEST_REMOTING_REMOTE_TEST_HELPER_H_ | |
6 #define CHROME_TEST_REMOTING_REMOTE_TEST_HELPER_H_ | |
7 | |
8 #include "content/public/test/browser_test_utils.h" | |
9 | |
10 namespace remoting { | |
11 | |
12 // Mirrored in host.js | |
13 enum Action { | |
14 ERROR = -1, | |
15 NONE = 0, | |
16 KEYDOWN = 1, | |
17 BUTTONPRESS = 2, | |
18 MOUSEMOVE = 3, | |
19 MOUSEWHEEL = 4, | |
20 DRAG = 5, | |
21 }; | |
22 | |
23 typedef struct { | |
24 Action action = Action::NONE; | |
Jamie
2014/12/17 03:15:41
I don't think this form of member initialization i
Jamie
2014/12/18 21:31:44
You haven't addressed this comment.
Mike Meade
2015/01/05 23:18:58
It looks like adding an inline constructor is what
| |
25 int value = 0; | |
26 int modifiers = 0; | |
27 } Event; | |
28 | |
29 class RemoteTestHelper { | |
30 public: | |
31 | |
32 // ctor. | |
Jamie
2014/12/17 03:15:41
You don't need this comment.
Mike Meade
2014/12/18 18:54:24
Done.
| |
33 explicit RemoteTestHelper(content::WebContents* web_content) | |
34 :web_content_(web_content) {} | |
Jamie
2014/12/17 03:15:40
Since you already have an .cc file for this class,
Mike Meade
2014/12/18 18:54:24
I got a lint warning indicating that since the onl
Jamie
2014/12/18 21:31:44
The use of explicit is fine; it's the inlining of
Mike Meade
2015/01/05 23:18:58
Done.
| |
35 | |
36 // Execute an RPC call within the provided context. | |
37 void ExecuteRpc(const std::string& method, int timeout_secs = 10) { | |
Jamie
2014/12/17 03:15:40
I don't think we're allowed to use default paramet
Mike Meade
2014/12/18 18:54:25
Done.
| |
38 ExecuteRpc(web_content_, method, timeout_secs); | |
39 } | |
40 static void ExecuteRpc(content::WebContents*, | |
41 const std::string&, | |
42 int timeout_secs = 2, | |
43 int poll_ms = 250); | |
44 | |
45 // Helper method to set the clear the last event | |
46 void ClearLastEvent() { | |
47 ClearLastEvent(web_content_); | |
48 } | |
49 static void ClearLastEvent(content::WebContents*); | |
Jamie
2014/12/17 03:15:40
Do you need any of the methods that take an explic
Mike Meade
2014/12/18 18:54:25
Done.
| |
50 | |
51 // Helper method to get the last event | |
52 void GetLastEvent(Event& event) { | |
Jamie
2014/12/17 03:15:40
Please double-check, but I don't think the style g
Mike Meade
2014/12/18 18:54:25
Done.
| |
53 GetLastEvent(web_content_, event); | |
54 } | |
Jamie
2014/12/17 03:15:41
Nit: indentation.
Mike Meade
2015/01/05 23:18:58
Done.
| |
55 static void GetLastEvent(content::WebContents*, Event&); | |
56 | |
57 protected: | |
Jamie
2014/12/17 03:15:40
It's not clear that this class is intended to be i
Mike Meade
2014/12/18 18:54:24
Done.
| |
58 // Execute a script and extract the value as an integer | |
59 static int ExecuteScriptAndExtractInt(content::WebContents*, | |
Jamie
2014/12/17 03:15:40
We already have definitions for these in RemoteDes
Mike Meade
2014/12/18 18:54:25
I moved the static ones from RemoteDesktopBrowserT
| |
60 const std::string&); | |
61 // Execute a script and extract the value as a boolean | |
62 static bool ExecuteScriptAndExtractBool(content::WebContents*, | |
63 const std::string&); | |
Jamie
2014/12/17 03:15:41
Nit: Indentation.
Mike Meade
2014/12/18 18:54:25
Done.
| |
64 | |
65 private: | |
Jamie
2014/12/17 03:15:41
You would typically have DISALLOW_COPY_AND_ASSIGN
Mike Meade
2014/12/18 18:54:24
Done.
| |
66 content::WebContents* web_content_; | |
67 | |
68 // Check for a valid last event | |
69 static bool CheckForLastEvent(content::WebContents*); | |
70 }; | |
71 | |
72 } // namespace remoting | |
73 | |
74 #endif // CHROME_TEST_REMOTING_REMOTE_TEST_HELPER_H_ | |
OLD | NEW |