| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 // Wait for the bookmark bar animation to complete. | 129 // Wait for the bookmark bar animation to complete. |
| 130 // If |wait_for_open| is true, wait for it to open. | 130 // If |wait_for_open| is true, wait for it to open. |
| 131 // If |wait_for_open| is false, wait for it to close. | 131 // If |wait_for_open| is false, wait for it to close. |
| 132 bool WaitForBookmarkBarVisibilityChange(bool wait_for_open); | 132 bool WaitForBookmarkBarVisibilityChange(bool wait_for_open); |
| 133 | 133 |
| 134 // Get the bookmarks as a JSON string. Internal method. | 134 // Get the bookmarks as a JSON string. Internal method. |
| 135 std::string _GetBookmarksAsJSON(); | 135 std::string _GetBookmarksAsJSON(); |
| 136 | 136 |
| 137 // Editing of the bookmark model. Bookmarks are referenced by id. | 137 // Editing of the bookmark model. Bookmarks are referenced by id. |
| 138 // The id is a std::wstring, not an int64, for convenience, since | 138 // The id is a string16, not an int64, for convenience, since |
| 139 // the python side gets IDs converted from a JSON representation | 139 // the python side gets IDs converted from a JSON representation |
| 140 // (which "extracts" into a string, not an int). Since IDs are | 140 // (which "extracts" into a string, not an int). Since IDs are |
| 141 // grabbed from the current model (and not generated), a conversion | 141 // grabbed from the current model (and not generated), a conversion |
| 142 // is unnecessary. URLs are strings and not GURLs for a similar reason. | 142 // is unnecessary. URLs are strings and not GURLs for a similar reason. |
| 143 // Bookmark or group (folder) creation: | 143 // Bookmark or group (folder) creation: |
| 144 bool AddBookmarkGroup(std::wstring& parent_id, int index, | 144 bool AddBookmarkGroup(const string16& parent_id, int index, |
| 145 std::wstring& title); | 145 const string16& title); |
| 146 bool AddBookmarkURL(std::wstring& parent_id, int index, | 146 bool AddBookmarkURL(const string16& parent_id, int index, |
| 147 std::wstring& title, std::wstring& url); | 147 const string16& title, const string16& url); |
| 148 // Bookmark editing: | 148 // Bookmark editing: |
| 149 bool ReparentBookmark(std::wstring& id, std::wstring& new_parent_id, | 149 bool ReparentBookmark(const string16& id, const string16& new_parent_id, |
| 150 int index); | 150 int index); |
| 151 bool SetBookmarkTitle(std::wstring& id, std::wstring& title); | 151 bool SetBookmarkTitle(const string16& id, const string16& title); |
| 152 bool SetBookmarkURL(std::wstring& id, std::wstring& url); | 152 bool SetBookmarkURL(const string16& id, const string16& url); |
| 153 // Finally, bookmark deletion: | 153 // Finally, bookmark deletion: |
| 154 bool RemoveBookmark(std::wstring& id); | 154 bool RemoveBookmark(const string16& id); |
| 155 | 155 |
| 156 // Get a handle to browser window at the given index, or NULL on failure. | 156 // Get a handle to browser window at the given index, or NULL on failure. |
| 157 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); | 157 scoped_refptr<BrowserProxy> GetBrowserWindow(int window_index); |
| 158 | 158 |
| 159 // Meta-method. Experimental pattern of passing args and response as | 159 // Meta-method. Experimental pattern of passing args and response as |
| 160 // JSON dict to avoid future use of the SWIG interface and | 160 // JSON dict to avoid future use of the SWIG interface and |
| 161 // automation proxy additions. Returns response as JSON dict. | 161 // automation proxy additions. Returns response as JSON dict. |
| 162 std::string _SendJSONRequest(int window_index, std::string& request); | 162 std::string _SendJSONRequest(int window_index, std::string& request); |
| 163 | 163 |
| 164 // Execute javascript in a given tab, and return the response. This is | 164 // Execute javascript in a given tab, and return the response. This is |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Enables PostTask to main thread. | 202 // Enables PostTask to main thread. |
| 203 // Should be shared across multiple instances of PyUITestBase so that this | 203 // Should be shared across multiple instances of PyUITestBase so that this |
| 204 // class is re-entrant and multiple instances can be created. | 204 // class is re-entrant and multiple instances can be created. |
| 205 // This is necessary since python's unittest module creates instances of | 205 // This is necessary since python's unittest module creates instances of |
| 206 // TestCase at load time itself. | 206 // TestCase at load time itself. |
| 207 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); | 207 static MessageLoop* GetSharedMessageLoop(MessageLoop::Type msg_loop_type); |
| 208 static MessageLoop* message_loop_; | 208 static MessageLoop* message_loop_; |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ | 211 #endif // CHROME_TEST_PYAUTOLIB_PYAUTOLIB_H_ |
| OLD | NEW |