| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "components/sessions/core/session_id.h" | |
| 13 | |
| 14 namespace sync_driver { | |
| 15 struct SyncedSession; | |
| 16 } | |
| 17 | |
| 18 namespace sync_pb { | |
| 19 class SessionSpecifics; | |
| 20 } | |
| 21 | |
| 22 namespace browser_sync { | |
| 23 | |
| 24 class SessionSyncTestHelper { | |
| 25 public: | |
| 26 SessionSyncTestHelper() : max_tab_node_id_(0) {} | |
| 27 | |
| 28 static void BuildSessionSpecifics(const std::string& tag, | |
| 29 sync_pb::SessionSpecifics* meta); | |
| 30 | |
| 31 static void AddWindowSpecifics(int window_id, | |
| 32 const std::vector<int>& tab_list, | |
| 33 sync_pb::SessionSpecifics* meta); | |
| 34 | |
| 35 static void VerifySyncedSession( | |
| 36 const std::string& tag, | |
| 37 const std::vector<std::vector<SessionID::id_type>>& windows, | |
| 38 const sync_driver::SyncedSession& session); | |
| 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. | |
| 43 void BuildTabSpecifics(const std::string& tag, | |
| 44 int window_id, | |
| 45 int tab_id, | |
| 46 sync_pb::SessionSpecifics* tab_base); | |
| 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 | |
| 56 sync_pb::SessionSpecifics BuildForeignSession( | |
| 57 const std::string& tag, | |
| 58 const std::vector<SessionID::id_type>& tab_list, | |
| 59 std::vector<sync_pb::SessionSpecifics>* tabs); | |
| 60 | |
| 61 void Reset(); | |
| 62 | |
| 63 private: | |
| 64 int max_tab_node_id_; | |
| 65 | |
| 66 DISALLOW_COPY_AND_ASSIGN(SessionSyncTestHelper); | |
| 67 }; | |
| 68 | |
| 69 } // namespace browser_sync | |
| 70 | |
| 71 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | |
| OLD | NEW |