OLD | NEW |
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 #include <map> | 5 #include <map> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void BuildTabSpecifics(const std::string& tag, int window_id, int tab_id, | 90 void BuildTabSpecifics(const std::string& tag, int window_id, int tab_id, |
91 sync_pb::SessionSpecifics* tab_base) { | 91 sync_pb::SessionSpecifics* tab_base) { |
92 tab_base->set_session_tag(tag); | 92 tab_base->set_session_tag(tag); |
93 sync_pb::SessionTab* tab = tab_base->mutable_tab(); | 93 sync_pb::SessionTab* tab = tab_base->mutable_tab(); |
94 tab->set_tab_id(tab_id); | 94 tab->set_tab_id(tab_id); |
95 tab->set_tab_visual_index(1); | 95 tab->set_tab_visual_index(1); |
96 tab->set_current_navigation_index(0); | 96 tab->set_current_navigation_index(0); |
97 tab->set_pinned(true); | 97 tab->set_pinned(true); |
98 tab->set_extension_app_id("app_id"); | 98 tab->set_extension_app_id("app_id"); |
99 sync_pb::TabNavigation* navigation = tab->add_navigation(); | 99 sync_pb::TabNavigation* navigation = tab->add_navigation(); |
100 navigation->set_index(12); | |
101 navigation->set_virtual_url("http://foo/1"); | 100 navigation->set_virtual_url("http://foo/1"); |
102 navigation->set_referrer("referrer"); | 101 navigation->set_referrer("referrer"); |
103 navigation->set_title("title"); | 102 navigation->set_title("title"); |
104 navigation->set_page_transition(sync_pb::TabNavigation_PageTransition_TYPED); | 103 navigation->set_page_transition(sync_pb::TabNavigation_PageTransition_TYPED); |
105 } | 104 } |
106 | 105 |
107 // Verifies number of windows, number of tabs, and basic fields. | 106 // Verifies number of windows, number of tabs, and basic fields. |
108 void VerifySyncedSession( | 107 void VerifySyncedSession( |
109 const std::string& tag, | 108 const std::string& tag, |
110 const std::vector<std::vector<SessionID::id_type> >& windows, | 109 const std::vector<std::vector<SessionID::id_type> >& windows, |
(...skipping 22 matching lines...) Expand all Loading... |
133 for (std::vector<int>::const_iterator tab_iter = (*win_iter).begin(); | 132 for (std::vector<int>::const_iterator tab_iter = (*win_iter).begin(); |
134 tab_iter != (*win_iter).end(); ++tab_iter, ++j) { | 133 tab_iter != (*win_iter).end(); ++tab_iter, ++j) { |
135 SessionTab* tab = win_ptr->tabs[j]; | 134 SessionTab* tab = win_ptr->tabs[j]; |
136 ASSERT_EQ(*tab_iter, tab->tab_id.id()); | 135 ASSERT_EQ(*tab_iter, tab->tab_id.id()); |
137 ASSERT_EQ(1U, tab->navigations.size()); | 136 ASSERT_EQ(1U, tab->navigations.size()); |
138 ASSERT_EQ(1, tab->tab_visual_index); | 137 ASSERT_EQ(1, tab->tab_visual_index); |
139 ASSERT_EQ(0, tab->current_navigation_index); | 138 ASSERT_EQ(0, tab->current_navigation_index); |
140 ASSERT_TRUE(tab->pinned); | 139 ASSERT_TRUE(tab->pinned); |
141 ASSERT_EQ("app_id", tab->extension_app_id); | 140 ASSERT_EQ("app_id", tab->extension_app_id); |
142 ASSERT_EQ(1U, tab->navigations.size()); | 141 ASSERT_EQ(1U, tab->navigations.size()); |
143 ASSERT_EQ(12, tab->navigations[0].index()); | |
144 ASSERT_EQ(tab->navigations[0].virtual_url(), GURL("http://foo/1")); | 142 ASSERT_EQ(tab->navigations[0].virtual_url(), GURL("http://foo/1")); |
145 ASSERT_EQ(tab->navigations[0].referrer().url, GURL("referrer")); | 143 ASSERT_EQ(tab->navigations[0].referrer().url, GURL("referrer")); |
146 ASSERT_EQ(tab->navigations[0].title(), string16(ASCIIToUTF16("title"))); | 144 ASSERT_EQ(tab->navigations[0].title(), string16(ASCIIToUTF16("title"))); |
147 ASSERT_EQ(tab->navigations[0].transition(), | 145 ASSERT_EQ(tab->navigations[0].transition(), |
148 content::PAGE_TRANSITION_TYPED); | 146 content::PAGE_TRANSITION_TYPED); |
149 } | 147 } |
150 } | 148 } |
151 } | 149 } |
152 | 150 |
153 } // namespace | 151 } // namespace |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 error = model_associator_->AssociateModels(); | 1123 error = model_associator_->AssociateModels(); |
1126 ASSERT_FALSE(error.IsSet()); | 1124 ASSERT_FALSE(error.IsSet()); |
1127 | 1125 |
1128 // Add some more tabs to ensure we don't conflict with the pre-existing tab | 1126 // Add some more tabs to ensure we don't conflict with the pre-existing tab |
1129 // node. | 1127 // node. |
1130 AddTab(browser(), GURL("http://baz1")); | 1128 AddTab(browser(), GURL("http://baz1")); |
1131 AddTab(browser(), GURL("http://baz2")); | 1129 AddTab(browser(), GURL("http://baz2")); |
1132 } | 1130 } |
1133 | 1131 |
1134 } // namespace browser_sync | 1132 } // namespace browser_sync |
OLD | NEW |