| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_GLUE_SESSION_SYNC_TEST_HELPER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 static void AddWindowSpecifics(int window_id, | 31 static void AddWindowSpecifics(int window_id, |
| 32 const std::vector<int>& tab_list, | 32 const std::vector<int>& tab_list, |
| 33 sync_pb::SessionSpecifics* meta); | 33 sync_pb::SessionSpecifics* meta); |
| 34 | 34 |
| 35 static void VerifySyncedSession( | 35 static void VerifySyncedSession( |
| 36 const std::string& tag, | 36 const std::string& tag, |
| 37 const std::vector<std::vector<SessionID::id_type>>& windows, | 37 const std::vector<std::vector<SessionID::id_type>>& windows, |
| 38 const sync_driver::SyncedSession& session); | 38 const sync_driver::SyncedSession& session); |
| 39 | 39 |
| 40 // Build a SessionSpecifics object with a tab and sample data. Uses a |
| 41 // monotonically increasing variable to generate tab_node_ids and avoid |
| 42 // conflicts. |
| 40 void BuildTabSpecifics(const std::string& tag, | 43 void BuildTabSpecifics(const std::string& tag, |
| 41 int window_id, | 44 int window_id, |
| 42 int tab_id, | 45 int tab_id, |
| 43 sync_pb::SessionSpecifics* tab_base); | 46 sync_pb::SessionSpecifics* tab_base); |
| 44 | 47 |
| 48 // Overload of BuildTabSpecifics to allow forcing a specific tab_node_id. |
| 49 // Typically only useful to test reusing tab_node_ids. |
| 50 void BuildTabSpecifics(const std::string& tag, |
| 51 int window_id, |
| 52 int tab_id, |
| 53 int tab_node_id, |
| 54 sync_pb::SessionSpecifics* tab_base); |
| 55 |
| 45 sync_pb::SessionSpecifics BuildForeignSession( | 56 sync_pb::SessionSpecifics BuildForeignSession( |
| 46 const std::string& tag, | 57 const std::string& tag, |
| 47 const std::vector<SessionID::id_type>& tab_list, | 58 const std::vector<SessionID::id_type>& tab_list, |
| 48 std::vector<sync_pb::SessionSpecifics>* tabs); | 59 std::vector<sync_pb::SessionSpecifics>* tabs); |
| 49 | 60 |
| 50 void Reset(); | 61 void Reset(); |
| 51 | 62 |
| 52 private: | 63 private: |
| 53 int max_tab_node_id_; | 64 int max_tab_node_id_; |
| 54 | 65 |
| 55 DISALLOW_COPY_AND_ASSIGN(SessionSyncTestHelper); | 66 DISALLOW_COPY_AND_ASSIGN(SessionSyncTestHelper); |
| 56 }; | 67 }; |
| 57 | 68 |
| 58 } // namespace browser_sync | 69 } // namespace browser_sync |
| 59 | 70 |
| 60 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | 71 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ |
| OLD | NEW |