| 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 COMPONENTS_SYNC_SESSIONS_SESSION_SYNC_TEST_HELPER_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_SESSION_SYNC_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/sessions/core/session_id.h" | 12 #include "components/sessions/core/session_id.h" |
| 13 | 13 |
| 14 namespace sync_driver { | |
| 15 struct SyncedSession; | |
| 16 } | |
| 17 | |
| 18 namespace sync_pb { | 14 namespace sync_pb { |
| 19 class SessionSpecifics; | 15 class SessionSpecifics; |
| 20 } | 16 } |
| 21 | 17 |
| 22 namespace browser_sync { | 18 namespace sync_sessions { |
| 19 |
| 20 struct SyncedSession; |
| 23 | 21 |
| 24 class SessionSyncTestHelper { | 22 class SessionSyncTestHelper { |
| 25 public: | 23 public: |
| 26 SessionSyncTestHelper() : max_tab_node_id_(0) {} | 24 SessionSyncTestHelper() : max_tab_node_id_(0) {} |
| 27 | 25 |
| 28 static void BuildSessionSpecifics(const std::string& tag, | 26 static void BuildSessionSpecifics(const std::string& tag, |
| 29 sync_pb::SessionSpecifics* meta); | 27 sync_pb::SessionSpecifics* meta); |
| 30 | 28 |
| 31 static void AddWindowSpecifics(int window_id, | 29 static void AddWindowSpecifics(int window_id, |
| 32 const std::vector<int>& tab_list, | 30 const std::vector<int>& tab_list, |
| 33 sync_pb::SessionSpecifics* meta); | 31 sync_pb::SessionSpecifics* meta); |
| 34 | 32 |
| 35 static void VerifySyncedSession( | 33 static void VerifySyncedSession( |
| 36 const std::string& tag, | 34 const std::string& tag, |
| 37 const std::vector<std::vector<SessionID::id_type>>& windows, | 35 const std::vector<std::vector<SessionID::id_type>>& windows, |
| 38 const sync_driver::SyncedSession& session); | 36 const SyncedSession& session); |
| 39 | 37 |
| 40 // Build a SessionSpecifics object with a tab and sample data. Uses a | 38 // Build a SessionSpecifics object with a tab and sample data. Uses a |
| 41 // monotonically increasing variable to generate tab_node_ids and avoid | 39 // monotonically increasing variable to generate tab_node_ids and avoid |
| 42 // conflicts. | 40 // conflicts. |
| 43 void BuildTabSpecifics(const std::string& tag, | 41 void BuildTabSpecifics(const std::string& tag, |
| 44 int window_id, | 42 int window_id, |
| 45 int tab_id, | 43 int tab_id, |
| 46 sync_pb::SessionSpecifics* tab_base); | 44 sync_pb::SessionSpecifics* tab_base); |
| 47 | 45 |
| 48 // Overload of BuildTabSpecifics to allow forcing a specific tab_node_id. | 46 // Overload of BuildTabSpecifics to allow forcing a specific tab_node_id. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 59 std::vector<sync_pb::SessionSpecifics>* tabs); | 57 std::vector<sync_pb::SessionSpecifics>* tabs); |
| 60 | 58 |
| 61 void Reset(); | 59 void Reset(); |
| 62 | 60 |
| 63 private: | 61 private: |
| 64 int max_tab_node_id_; | 62 int max_tab_node_id_; |
| 65 | 63 |
| 66 DISALLOW_COPY_AND_ASSIGN(SessionSyncTestHelper); | 64 DISALLOW_COPY_AND_ASSIGN(SessionSyncTestHelper); |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 } // namespace browser_sync | 67 } // namespace sync_sessions |
| 70 | 68 |
| 71 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_SYNC_TEST_HELPER_H_ | 69 #endif // COMPONENTS_SYNC_SESSIONS_SESSION_SYNC_TEST_HELPER_H_ |
| OLD | NEW |