Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: chrome/browser/sync/test/integration/sessions_helper.h

Issue 2750163003: Prevent tabs sync during browser shutdown.
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // Close a tab in the browser at |index| and block until the
91 // session model associator is aware of it.
92 bool CloseTabAtIndex(int index, int tab_index, const GURL& url);
93
90 // Moves the tab in position |tab_index| in the TabStrip for browser at 94 // Moves the tab in position |tab_index| in the TabStrip for browser at
91 // |from_index| to the TabStrip for browser at |to_index|. 95 // |from_index| to the TabStrip for browser at |to_index|.
92 void MoveTab(int from_index, int to_index, int tab_index); 96 void MoveTab(int from_index, int to_index, int tab_index);
93 97
94 // Navigate the active tab for browser in position |index| to the given 98 // 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. 99 // 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. 100 // 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 101 // 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 102 // indefinitely. Use a data uri or the embedded_test_server to ensure that this
99 // doesn't happen. 103 // doesn't happen.
100 bool NavigateTab(int index, const GURL& url); 104 bool NavigateTab(int index, const GURL& url);
101 105
102 // Navigate the active tab for browser in position |index| back by one; 106 // Navigate the active tab for browser in position |index| back by one;
103 // if this isn't possible, does nothing 107 // if this isn't possible, does nothing
104 void NavigateTabBack(int index); 108 void NavigateTabBack(int index);
105 109
106 // Navigate the active tab for browser in position |index| forward by 110 // Navigate the active tab for browser in position |index| forward by
107 // one; if this isn't possible, does nothing 111 // one; if this isn't possible, does nothing
108 void NavigateTabForward(int index); 112 void NavigateTabForward(int index);
109 113
110 // Open multiple tabs and block until the session model associator is aware 114 // Open multiple tabs and block until the session model associator is aware
111 // of all of them. Returns true on success, false on failure. 115 // of all of them. Returns true on success, false on failure.
112 bool OpenMultipleTabs(int index, const std::vector<GURL>& urls); 116 bool OpenMultipleTabs(int index, const std::vector<GURL>& urls);
113 117
114 // Wait for a session change to propagate to the model associator. Will not 118 // Wait for a session change to propagate to the model associator. Will not
115 // return until each url in |urls| has been found. 119 // return until each url in |urls| has been found.
116 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls); 120 bool WaitForTabsToLoad(int index, const std::vector<GURL>& urls);
117 121
122 // Wait for a session change to propagate to the model associator. Will not
123 // return until each url in |urls| has been closed.
124 bool WaitForTabsToClose(int index, const std::vector<GURL>& urls);
125
118 // Check if the session model associator's knows that the current open tab 126 // Check if the session model associator's knows that the current open tab
119 // has this url. 127 // has this url.
120 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url); 128 bool ModelAssociatorHasTabWithUrl(int index, const GURL& url);
121 129
122 // Stores a pointer to the local session for a given profile in |session|. 130 // Stores a pointer to the local session for a given profile in |session|.
123 // Returns true on success, false on failure. 131 // Returns true on success, false on failure.
124 bool GetLocalSession(int index, const sync_sessions::SyncedSession** session); 132 bool GetLocalSession(int index, const sync_sessions::SyncedSession** session);
125 133
126 // Deletes the foreign session with tag |session_tag| from the profile specified 134 // Deletes the foreign session with tag |session_tag| from the profile specified
127 // by |index|. This will affect all synced clients. 135 // by |index|. This will affect all synced clients.
(...skipping 14 matching lines...) Expand all
142 // StatusChangeChecker implementation. 150 // StatusChangeChecker implementation.
143 bool IsExitConditionSatisfied() override; 151 bool IsExitConditionSatisfied() override;
144 std::string GetDebugMessage() const override; 152 std::string GetDebugMessage() const override;
145 153
146 private: 154 private:
147 int index_; 155 int index_;
148 const std::vector<sessions_helper::ScopedWindowMap>& windows_; 156 const std::vector<sessions_helper::ScopedWindowMap>& windows_;
149 }; 157 };
150 158
151 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_ 159 #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SESSIONS_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698