Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.cc

Issue 213003004: Replace calls to 3-arg SyncData::CreateLocalData with 5-arg version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Apply feedback from review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h" 5 #include "chrome/browser/ui/toolbar/recent_tabs_builder_test_helper.h"
6 6
7 #include "base/rand_util.h" 7 #include "base/rand_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/sync/glue/session_model_associator.h" 11 #include "chrome/browser/sync/glue/session_model_associator.h"
12 #include "chrome/browser/sync/open_tabs_ui_delegate.h" 12 #include "chrome/browser/sync/open_tabs_ui_delegate.h"
13 #include "chrome/browser/sync/sessions2/sessions_sync_manager.h" 13 #include "chrome/browser/sync/sessions2/sessions_sync_manager.h"
14 #include "sync/api/attachments/attachment_id.h"
15 #include "sync/api/attachments/attachment_service_proxy_for_test.h"
14 #include "sync/protocol/session_specifics.pb.h" 16 #include "sync/protocol/session_specifics.pb.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
17 namespace { 19 namespace {
18 20
19 const char kBaseSessionTag[] = "session_tag"; 21 const char kBaseSessionTag[] = "session_tag";
20 const char kBaseSessionName[] = "session_name"; 22 const char kBaseSessionName[] = "session_name";
21 const char kBaseTabUrl[] = "http://foo/?"; 23 const char kBaseTabUrl[] = "http://foo/?";
22 const char kTabTitleFormat[] = "session=%d;window=%d;tab=%d"; 24 const char kTabTitleFormat[] = "session=%d;window=%d;tab=%d";
23 25
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 sync_pb::EntitySpecifics session_entity; 188 sync_pb::EntitySpecifics session_entity;
187 sync_pb::SessionSpecifics* meta = session_entity.mutable_session(); 189 sync_pb::SessionSpecifics* meta = session_entity.mutable_session();
188 BuildSessionSpecifics(s, meta); 190 BuildSessionSpecifics(s, meta);
189 for (int w = 0; w < GetWindowCount(s); ++w) { 191 for (int w = 0; w < GetWindowCount(s); ++w) {
190 BuildWindowSpecifics(s, w, meta); 192 BuildWindowSpecifics(s, w, meta);
191 for (int t = 0; t < GetTabCount(s, w); ++t) { 193 for (int t = 0; t < GetTabCount(s, w); ++t) {
192 sync_pb::EntitySpecifics entity; 194 sync_pb::EntitySpecifics entity;
193 sync_pb::SessionSpecifics* tab_base = entity.mutable_session(); 195 sync_pb::SessionSpecifics* tab_base = entity.mutable_session();
194 BuildTabSpecifics(s, w, t, tab_base); 196 BuildTabSpecifics(s, w, t, tab_base);
195 changes.push_back(syncer::SyncChange( 197 changes.push_back(syncer::SyncChange(
196 FROM_HERE, syncer::SyncChange::ACTION_ADD, 198 FROM_HERE,
199 syncer::SyncChange::ACTION_ADD,
197 syncer::SyncData::CreateRemoteData( 200 syncer::SyncData::CreateRemoteData(
198 tab_base->tab_node_id(), entity, GetTabTimestamp(s, w, t)))); 201 tab_base->tab_node_id(),
202 entity,
203 GetTabTimestamp(s, w, t),
204 syncer::AttachmentIdList(),
205 syncer::AttachmentServiceProxyForTest::Create())));
199 } 206 }
200 } 207 }
201 changes.push_back(syncer::SyncChange( 208 changes.push_back(syncer::SyncChange(
202 FROM_HERE, syncer::SyncChange::ACTION_ADD, 209 FROM_HERE,
203 syncer::SyncData::CreateRemoteData(1, session_entity, 210 syncer::SyncChange::ACTION_ADD,
204 GetSessionTimestamp(s)))); 211 syncer::SyncData::CreateRemoteData(
212 1,
213 session_entity,
214 GetSessionTimestamp(s),
215 syncer::AttachmentIdList(),
216 syncer::AttachmentServiceProxyForTest::Create())));
205 } 217 }
206 manager->ProcessSyncChanges(FROM_HERE, changes); 218 manager->ProcessSyncChanges(FROM_HERE, changes);
207 VerifyExport(manager); 219 VerifyExport(manager);
208 } 220 }
209 221
210 void RecentTabsBuilderTestHelper::ExportToSessionModelAssociator( 222 void RecentTabsBuilderTestHelper::ExportToSessionModelAssociator(
211 browser_sync::SessionModelAssociator* associator) { 223 browser_sync::SessionModelAssociator* associator) {
212 for (int s = 0; s < GetSessionCount(); ++s) { 224 for (int s = 0; s < GetSessionCount(); ++s) {
213 sync_pb::SessionSpecifics meta; 225 sync_pb::SessionSpecifics meta;
214 BuildSessionSpecifics(s, &meta); 226 BuildSessionSpecifics(s, &meta);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 tab->set_current_navigation_index(0); 317 tab->set_current_navigation_index(0);
306 tab->set_pinned(true); 318 tab->set_pinned(true);
307 tab->set_extension_app_id("app_id"); 319 tab->set_extension_app_id("app_id");
308 sync_pb::TabNavigation* navigation = tab->add_navigation(); 320 sync_pb::TabNavigation* navigation = tab->add_navigation();
309 navigation->set_virtual_url(ToTabUrl(session_id, window_id, tab_id)); 321 navigation->set_virtual_url(ToTabUrl(session_id, window_id, tab_id));
310 navigation->set_referrer("referrer"); 322 navigation->set_referrer("referrer");
311 navigation->set_title(base::UTF16ToUTF8(GetTabTitle( 323 navigation->set_title(base::UTF16ToUTF8(GetTabTitle(
312 session_index, window_index, tab_index))); 324 session_index, window_index, tab_index)));
313 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED); 325 navigation->set_page_transition(sync_pb::SyncEnums_PageTransition_TYPED);
314 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698