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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 named_channel_id_ = named_channel_id; | 63 named_channel_id_ = named_channel_id; |
64 launcher_.reset(CreateProxyLauncher()); | 64 launcher_.reset(CreateProxyLauncher()); |
65 } | 65 } |
66 | 66 |
67 virtual ProxyLauncher* CreateProxyLauncher() OVERRIDE; | 67 virtual ProxyLauncher* CreateProxyLauncher() OVERRIDE; |
68 | 68 |
69 // SetUp,TearDown is redeclared as public to make it accessible from swig. | 69 // SetUp,TearDown is redeclared as public to make it accessible from swig. |
70 virtual void SetUp() OVERRIDE; | 70 virtual void SetUp() OVERRIDE; |
71 virtual void TearDown() OVERRIDE; | 71 virtual void TearDown() OVERRIDE; |
72 | 72 |
73 // Navigate to the given URL in the active tab. Blocks until page loaded. | |
74 void NavigateToURL(const char* url_string); | |
75 | |
76 // Navigate to the given URL in the active tab in the given window. | |
77 void NavigateToURL(const char* url_string, int window_index); | |
78 | |
79 // Navigate to the given URL in given tab in the given window. | |
80 // Blocks until page loaded. | |
81 void NavigateToURL(const char* url_string, int window_index, int tab_index); | |
82 | |
83 // Reloads the active tab in the given window. | |
84 // Blocks until page reloaded. | |
85 void ReloadActiveTab(int window_index = 0); | |
86 | |
87 // Get the URL of the active tab. | 73 // Get the URL of the active tab. |
88 GURL GetActiveTabURL(int window_index = 0); | 74 GURL GetActiveTabURL(int window_index = 0); |
89 | 75 |
90 int GetTabCount(int window_index = 0); | 76 int GetTabCount(int window_index = 0); |
91 | 77 |
92 // Appends a new tab with the given URL in the given or first browser window. | |
93 bool AppendTab(const GURL& tab_url, int window_index = 0); | |
94 | |
95 // Activate the tab at the given zero-based index in the given or first | 78 // Activate the tab at the given zero-based index in the given or first |
96 // browser window. Also brings the window to front. | 79 // browser window. Also brings the window to front. |
97 bool ActivateTab(int tab_index, int window_index = 0); | 80 bool ActivateTab(int tab_index, int window_index = 0); |
98 | 81 |
99 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) to the | 82 // Apply the accelerator with given id (IDC_BACK, IDC_NEWTAB ...) to the |
100 // browser window at the given or first index. | 83 // browser window at the given or first index. |
101 // The list can be found at chrome/app/chrome_command_ids.h | 84 // The list can be found at chrome/app/chrome_command_ids.h |
102 // Returns true if the call was successful. | 85 // Returns true if the call was successful. |
103 bool ApplyAccelerator(int id, int window_index = 0); | 86 bool ApplyAccelerator(int id, int window_index = 0); |
104 | 87 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // This is necessary since python's unittest module creates instances of | 214 // This is necessary since python's unittest module creates instances of |
232 // TestCase at load time itself. | 215 // TestCase at load time itself. |
233 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 216 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
234 static MessageLoop* message_loop_; | 217 static MessageLoop* message_loop_; |
235 | 218 |
236 // Path to named channel id. | 219 // Path to named channel id. |
237 std::string named_channel_id_; | 220 std::string named_channel_id_; |
238 }; | 221 }; |
239 | 222 |
240 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 223 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
OLD | NEW |