| 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 #include "chrome/browser/sync/glue/session_sync_test_helper.h" | 5 #include "chrome/browser/sync/glue/session_sync_test_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/sync_sessions/synced_session.h" | 10 #include "components/sync_sessions/synced_session.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 ui::PAGE_TRANSITION_TYPED); | 91 ui::PAGE_TRANSITION_TYPED); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 void SessionSyncTestHelper::BuildTabSpecifics( | 96 void SessionSyncTestHelper::BuildTabSpecifics( |
| 97 const std::string& tag, | 97 const std::string& tag, |
| 98 int window_id, | 98 int window_id, |
| 99 int tab_id, | 99 int tab_id, |
| 100 sync_pb::SessionSpecifics* tab_base) { | 100 sync_pb::SessionSpecifics* tab_base) { |
| 101 BuildTabSpecifics(tag, window_id, tab_id, ++max_tab_node_id_, tab_base); |
| 102 } |
| 103 |
| 104 void SessionSyncTestHelper::BuildTabSpecifics( |
| 105 const std::string& tag, |
| 106 int window_id, |
| 107 int tab_id, |
| 108 int tab_node_id, |
| 109 sync_pb::SessionSpecifics* tab_base) { |
| 101 tab_base->set_session_tag(tag); | 110 tab_base->set_session_tag(tag); |
| 102 tab_base->set_tab_node_id(++max_tab_node_id_); | 111 tab_base->set_tab_node_id(tab_node_id); |
| 103 sync_pb::SessionTab* tab = tab_base->mutable_tab(); | 112 sync_pb::SessionTab* tab = tab_base->mutable_tab(); |
| 104 tab->set_tab_id(tab_id); | 113 tab->set_tab_id(tab_id); |
| 105 tab->set_tab_visual_index(1); | 114 tab->set_tab_visual_index(1); |
| 106 tab->set_current_navigation_index(0); | 115 tab->set_current_navigation_index(0); |
| 107 tab->set_pinned(true); | 116 tab->set_pinned(true); |
| 108 tab->set_extension_app_id(kAppId); | 117 tab->set_extension_app_id(kAppId); |
| 109 sync_pb::TabNavigation* navigation = tab->add_navigation(); | 118 sync_pb::TabNavigation* navigation = tab->add_navigation(); |
| 110 navigation->set_virtual_url(kVirtualUrl); | 119 navigation->set_virtual_url(kVirtualUrl); |
| 111 navigation->set_referrer(kReferrer); | 120 navigation->set_referrer(kReferrer); |
| 112 navigation->set_title(kTitle); | 121 navigation->set_title(kTitle); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 129 for (size_t i = 0; i < tab_list.size(); ++i) { | 138 for (size_t i = 0; i < tab_list.size(); ++i) { |
| 130 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]); | 139 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]); |
| 131 } | 140 } |
| 132 | 141 |
| 133 if (tabs) | 142 if (tabs) |
| 134 tabs->swap(tabs1); | 143 tabs->swap(tabs1); |
| 135 return meta; | 144 return meta; |
| 136 } | 145 } |
| 137 | 146 |
| 138 } // namespace browser_sync | 147 } // namespace browser_sync |
| OLD | NEW |