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 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ |
6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
80 // session model associator is aware of it. Returns true upon success, false | 80 // session model associator is aware of it. Returns true upon success, false |
81 // otherwise. | 81 // otherwise. |
82 bool OpenTab(int index, const GURL& url); | 82 bool OpenTab(int index, const GURL& url); |
83 | 83 |
84 // See OpenTab, except that the tab is opened in position |tab_index|. | 84 // See OpenTab, except that the tab is opened in position |tab_index|. |
85 // If |tab_index| is -1 or greater than the number of tabs, the tab will be | 85 // If |tab_index| is -1 or greater than the number of tabs, the tab will be |
86 // appended to the end of the strip. i.e. if tab_index is 3 for a tab strip of | 86 // appended to the end of the strip. i.e. if tab_index is 3 for a tab strip of |
87 // size 1, the new tab will be in position 1. | 87 // size 1, the new tab will be in position 1. |
88 bool OpenTabAtIndex(int index, int tab_index, const GURL& url); | 88 bool OpenTabAtIndex(int index, int tab_index, const GURL& url); |
89 | 89 |
90 // Opens |url| from the WebContents at |index_of_source_tab| using | |
91 // |disposition|. | |
92 bool OpenTabFromSourceIndex(int index, | |
93 int index_of_source_tab, | |
94 const GURL& url, | |
95 WindowOpenDisposition disposition); | |
96 | |
97 // Open multiple tabs and block until the session model associator is aware | |
98 // of all of them. Returns true on success, false on failure. | |
99 bool OpenMultipleTabs(int index, const std::vector<GURL>& urls); | |
100 | |
90 // Moves the tab in position |tab_index| in the TabStrip for browser at | 101 // Moves the tab in position |tab_index| in the TabStrip for browser at |
91 // |from_index| to the TabStrip for browser at |to_index|. | 102 // |from_index| to the TabStrip for browser at |to_index|. |
92 void MoveTab(int from_index, int to_index, int tab_index); | 103 void MoveTab(int from_index, int to_index, int tab_index); |
93 | 104 |
94 // Navigate the active tab for browser in position |index| to the given | 105 // Navigate the active tab for browser in position |index| to the given |
95 // url, and blocks until the session model associator is aware of it. | 106 // url, and blocks until the session model associator is aware of it. |
96 // WARNING: it's dangerous to assume this will return for any arbitrary URL. | 107 // WARNING: it's dangerous to assume this will return for any arbitrary URL. |
97 // For URLs that don't resolve to a valid server response, this can block | 108 // For URLs that don't resolve to a valid server response, this can block |
98 // indefinitely. Use a data uri or the embedded_test_server to ensure that this | 109 // indefinitely. Use a data uri or the embedded_test_server to ensure that this |
99 // doesn't happen. | 110 // doesn't happen. |
100 bool NavigateTab(int index, const GURL& url); | 111 bool NavigateTab(int index, const GURL& url); |
101 | 112 |
102 // Navigate the active tab for browser in position |index| back by one; | 113 // Navigate the active tab for browser in position |index| back by one; |
103 // if this isn't possible, does nothing | 114 // if this isn't possible, does nothing |
104 void NavigateTabBack(int index); | 115 void NavigateTabBack(int index); |
105 | 116 |
106 // Navigate the active tab for browser in position |index| forward by | 117 // Navigate the active tab for browser in position |index| forward by |
107 // one; if this isn't possible, does nothing | 118 // one; if this isn't possible, does nothing |
108 void NavigateTabForward(int index); | 119 void NavigateTabForward(int index); |
109 | 120 |
110 // Open multiple tabs and block until the session model associator is aware | 121 // Wait for a session change to propagate to the model associator. Will return |
Nicolas Zea
2017/03/16 19:57:44
nit: s/model associator/syncableservice, here and
Patrick Noland
2017/03/17 00:20:10
Done.
| |
111 // of all of them. Returns true on success, false on failure. | 122 // true once |url| has been found, or false if it times out while waiting. |
112 bool OpenMultipleTabs(int index, const std::vector<GURL>& urls); | 123 bool WaitForTabToLoad(int index, |
124 const GURL& url, | |
125 content::WebContents* WebContents); | |
113 | 126 |
114 // Wait for a session change to propagate to the model associator. Will not | 127 // Wait for each url in |urls| to load. The ordering of |urls| is assumed to |
115 // return until each url in |urls| has been found. | 128 // match the ordering of the corresponding tabs. |
116 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls); | 129 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls); |
117 | 130 |
118 // Check if the session model associator's knows that the current open tab | 131 // Check if the session model associator's knows that the current open tab |
119 // has this url. | 132 // has this url. |
120 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url); | 133 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url); |
121 | 134 |
122 // Stores a pointer to the local session for a given profile in |session|. | 135 // Stores a pointer to the local session for a given profile in |session|. |
123 // Returns true on success, false on failure. | 136 // Returns true on success, false on failure. |
124 bool GetLocalSession(int index, const sync_sessions::SyncedSession** session); | 137 bool GetLocalSession(int index, const sync_sessions::SyncedSession** session); |
125 | 138 |
(...skipping 16 matching lines...) Expand all Loading... | |
142 // StatusChangeChecker implementation. | 155 // StatusChangeChecker implementation. |
143 bool IsExitConditionSatisfied() override; | 156 bool IsExitConditionSatisfied() override; |
144 std::string GetDebugMessage() const override; | 157 std::string GetDebugMessage() const override; |
145 | 158 |
146 private: | 159 private: |
147 int index_; | 160 int index_; |
148 const std::vector<sessions_helper::ScopedWindowMap>& windows_; | 161 const std::vector<sessions_helper::ScopedWindowMap>& windows_; |
149 }; | 162 }; |
150 | 163 |
151 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ | 164 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ |
OLD | NEW |