OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file declares the C++ side of PyAuto, the python interface to | 5 // This file declares the C++ side of PyAuto, the python interface to |
6 // Chromium automation. It access Chromium's internals using Automation Proxy. | 6 // Chromium automation. It access Chromium's internals using Automation Proxy. |
7 | 7 |
8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 8 #ifndef CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 9 #define CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 named_channel_id_ = named_channel_id; | 62 named_channel_id_ = named_channel_id; |
63 launcher_.reset(CreateProxyLauncher()); | 63 launcher_.reset(CreateProxyLauncher()); |
64 } | 64 } |
65 | 65 |
66 virtual ProxyLauncher* CreateProxyLauncher() OVERRIDE; | 66 virtual ProxyLauncher* CreateProxyLauncher() OVERRIDE; |
67 | 67 |
68 // SetUp,TearDown is redeclared as public to make it accessible from swig. | 68 // SetUp,TearDown is redeclared as public to make it accessible from swig. |
69 virtual void SetUp() OVERRIDE; | 69 virtual void SetUp() OVERRIDE; |
70 virtual void TearDown() OVERRIDE; | 70 virtual void TearDown() OVERRIDE; |
71 | 71 |
72 // Navigate to the given URL in the active tab. Blocks until page loaded. | |
73 void NavigateToURL(const char* url_string); | |
74 | |
75 // Navigate to the given URL in the active tab in the given window. | |
76 void NavigateToURL(const char* url_string, int window_index); | |
77 | |
78 // Navigate to the given URL in given tab in the given window. | |
79 // Blocks until page loaded. | |
80 void NavigateToURL(const char* url_string, int window_index, int tab_index); | |
81 | |
82 // Reloads the active tab in the given window. | |
83 // Blocks until page reloaded. | |
84 void ReloadActiveTab(int window_index = 0); | |
85 | |
86 // Get the URL of the active tab. | 72 // Get the URL of the active tab. |
87 GURL GetActiveTabURL(int window_index = 0); | 73 GURL GetActiveTabURL(int window_index = 0); |
88 | 74 |
89 int GetTabCount(int window_index = 0); | 75 int GetTabCount(int window_index = 0); |
90 | 76 |
91 // Appends a new tab with the given URL in the given or first browser window. | |
92 bool AppendTab(const GURL& tab_url, int window_index = 0); | |
93 | |
94 // Activate the tab at the given zero-based index in the given or first | 77 // Activate the tab at the given zero-based index in the given or first |
95 // browser window. Also brings the window to front. | 78 // browser window. Also brings the window to front. |
96 bool ActivateTab(int tab_index, int window_index = 0); | 79 bool ActivateTab(int tab_index, int window_index = 0); |
97 | 80 |
98 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) to the | 81 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) to the |
99 // browser window at the given or first index. | 82 // browser window at the given or first index. |
100 // The list can be found at chrome/app/chrome_command_ids.h | 83 // The list can be found at chrome/app/chrome_command_ids.h |
101 // Returns true if the call was successful. | 84 // Returns true if the call was successful. |
102 bool ApplyAccelerator(int id, int window_index = 0); | 85 bool ApplyAccelerator(int id, int window_index = 0); |
103 | 86 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // This is necessary since python's unittest module creates instances of | 203 // This is necessary since python's unittest module creates instances of |
221 // TestCase at load time itself. | 204 // TestCase at load time itself. |
222 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 205 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
223 static MessageLoop* message_loop_; | 206 static MessageLoop* message_loop_; |
224 | 207 |
225 // Path to named channel id. | 208 // Path to named channel id. |
226 std::string named_channel_id_; | 209 std::string named_channel_id_; |
227 }; | 210 }; |
228 | 211 |
229 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 212 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |