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

Side by Side Diff: chrome/browser/sync/glue/session_sync_test_helper.cc

Issue 2343463003: [Sync] Fix namespaces for the sync_sessions component. (Closed)
Patch Set: Fix Android. Created 4 years, 3 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 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/protocol/session_specifics.pb.h" 10 #include "components/sync/protocol/session_specifics.pb.h"
11 #include "components/sync/protocol/sync_enums.pb.h" 11 #include "components/sync/protocol/sync_enums.pb.h"
12 #include "components/sync_sessions/synced_session.h" 12 #include "components/sync_sessions/synced_session.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 15 namespace sync_sessions {
skym 2016/09/14 22:29:58 Please move to components/sync_sessions before thi
maxbogue 2016/09/15 00:43:53 Done.
16 namespace browser_sync {
17 16
18 static const char* kClientName = "name"; 17 static const char* kClientName = "name";
19 static const char* kAppId = "app_id"; 18 static const char* kAppId = "app_id";
20 static const char* kVirtualUrl = "http://foo/1"; 19 static const char* kVirtualUrl = "http://foo/1";
21 static const char* kReferrer = "referrer"; 20 static const char* kReferrer = "referrer";
22 static const char* kTitle = "title"; 21 static const char* kTitle = "title";
23 22
24 // static 23 // static
25 void SessionSyncTestHelper::BuildSessionSpecifics( 24 void SessionSyncTestHelper::BuildSessionSpecifics(
26 const std::string& tag, 25 const std::string& tag,
(...skipping 17 matching lines...) Expand all
44 for (std::vector<int>::const_iterator iter = tab_list.begin(); 43 for (std::vector<int>::const_iterator iter = tab_list.begin();
45 iter != tab_list.end(); ++iter) { 44 iter != tab_list.end(); ++iter) {
46 window->add_tab(*iter); 45 window->add_tab(*iter);
47 } 46 }
48 } 47 }
49 48
50 // static 49 // static
51 void SessionSyncTestHelper::VerifySyncedSession( 50 void SessionSyncTestHelper::VerifySyncedSession(
52 const std::string& tag, 51 const std::string& tag,
53 const std::vector<std::vector<SessionID::id_type>>& windows, 52 const std::vector<std::vector<SessionID::id_type>>& windows,
54 const sync_driver::SyncedSession& session) { 53 const SyncedSession& session) {
55 ASSERT_EQ(tag, session.session_tag); 54 ASSERT_EQ(tag, session.session_tag);
56 ASSERT_EQ(sync_driver::SyncedSession::TYPE_LINUX, session.device_type); 55 ASSERT_EQ(SyncedSession::TYPE_LINUX, session.device_type);
57 ASSERT_EQ(kClientName, session.session_name); 56 ASSERT_EQ(kClientName, session.session_name);
58 ASSERT_EQ(windows.size(), session.windows.size()); 57 ASSERT_EQ(windows.size(), session.windows.size());
59 58
60 // We assume the window id's are in increasing order. 59 // We assume the window id's are in increasing order.
61 int i = 0; 60 int i = 0;
62 for (std::vector<std::vector<int> >::const_iterator win_iter = 61 for (std::vector<std::vector<int> >::const_iterator win_iter =
63 windows.begin(); 62 windows.begin();
64 win_iter != windows.end(); ++win_iter, ++i) { 63 win_iter != windows.end(); ++win_iter, ++i) {
65 sessions::SessionWindow* win_ptr; 64 sessions::SessionWindow* win_ptr;
66 sync_driver::SyncedSession::SyncedWindowMap::const_iterator map_iter = 65 SyncedSession::SyncedWindowMap::const_iterator map_iter =
67 session.windows.find(i); 66 session.windows.find(i);
68 if (map_iter != session.windows.end()) 67 if (map_iter != session.windows.end())
69 win_ptr = map_iter->second; 68 win_ptr = map_iter->second;
70 else 69 else
71 FAIL(); 70 FAIL();
72 ASSERT_EQ(win_iter->size(), win_ptr->tabs.size()); 71 ASSERT_EQ(win_iter->size(), win_ptr->tabs.size());
73 ASSERT_EQ(0, win_ptr->selected_tab_index); 72 ASSERT_EQ(0, win_ptr->selected_tab_index);
74 ASSERT_EQ(sessions::SessionWindow::TYPE_TABBED, win_ptr->type); 73 ASSERT_EQ(sessions::SessionWindow::TYPE_TABBED, win_ptr->type);
75 int j = 0; 74 int j = 0;
76 for (std::vector<int>::const_iterator tab_iter = (*win_iter).begin(); 75 for (std::vector<int>::const_iterator tab_iter = (*win_iter).begin();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 tabs1.resize(tab_list.size()); 136 tabs1.resize(tab_list.size());
138 for (size_t i = 0; i < tab_list.size(); ++i) { 137 for (size_t i = 0; i < tab_list.size(); ++i) {
139 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]); 138 BuildTabSpecifics(tag, 0, tab_list[i], &tabs1[i]);
140 } 139 }
141 140
142 if (tabs) 141 if (tabs)
143 tabs->swap(tabs1); 142 tabs->swap(tabs1);
144 return meta; 143 return meta;
145 } 144 }
146 145
147 } // namespace browser_sync 146 } // namespace sync_sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698