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

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

Issue 10985008: sync: Add DeviceInfo protobuf and supporting code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 SessionTypesTestHelper::CreateNavigation( 113 SessionTypesTestHelper::CreateNavigation(
114 std::string(chrome::kChromeUINewTabURL) + "#bookmarks", "title"); 114 std::string(chrome::kChromeUINewTabURL) + "#bookmarks", "title");
115 tab.navigations.push_back(nav); 115 tab.navigations.push_back(nav);
116 // NewTab does not count as valid if it's the only navigation. 116 // NewTab does not count as valid if it's the only navigation.
117 ASSERT_FALSE(ShouldSyncSessionTab(tab)); 117 ASSERT_FALSE(ShouldSyncSessionTab(tab));
118 } 118 }
119 119
120 TEST_F(SyncSessionModelAssociatorTest, PopulateSessionHeader) { 120 TEST_F(SyncSessionModelAssociatorTest, PopulateSessionHeader) {
121 sync_pb::SessionHeader header_s; 121 sync_pb::SessionHeader header_s;
122 header_s.set_client_name("Client 1"); 122 header_s.set_client_name("Client 1");
123 header_s.set_device_type(sync_pb::SessionHeader_DeviceType_TYPE_WIN); 123 header_s.set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_WIN);
124 124
125 SyncedSession session; 125 SyncedSession session;
126 base::Time time = base::Time::Now(); 126 base::Time time = base::Time::Now();
127 SessionModelAssociator::PopulateSessionHeaderFromSpecifics( 127 SessionModelAssociator::PopulateSessionHeaderFromSpecifics(
128 header_s, time, &session); 128 header_s, time, &session);
129 ASSERT_EQ("Client 1", session.session_name); 129 ASSERT_EQ("Client 1", session.session_name);
130 ASSERT_EQ(SyncedSession::TYPE_WIN, session.device_type); 130 ASSERT_EQ(SyncedSession::TYPE_WIN, session.device_type);
131 ASSERT_EQ(time, session.modified_time); 131 ASSERT_EQ(time, session.modified_time);
132 } 132 }
133 133
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 sync_tab.navigation(2).virtual_url()); 825 sync_tab.navigation(2).virtual_url());
826 EXPECT_EQ(1, sync_tab.current_navigation_index()); 826 EXPECT_EQ(1, sync_tab.current_navigation_index());
827 EXPECT_EQ(syncer::TimeToProtoTime(prev_tab.navigations[0].timestamp()), 827 EXPECT_EQ(syncer::TimeToProtoTime(prev_tab.navigations[0].timestamp()),
828 sync_tab.navigation(0).timestamp()); 828 sync_tab.navigation(0).timestamp());
829 EXPECT_LE(now, sync_tab.navigation(1).timestamp()); 829 EXPECT_LE(now, sync_tab.navigation(1).timestamp());
830 EXPECT_LE(now, sync_tab.navigation(2).timestamp()); 830 EXPECT_LE(now, sync_tab.navigation(2).timestamp());
831 EXPECT_EQ(3U, prev_tab.navigations.size()); 831 EXPECT_EQ(3U, prev_tab.navigations.size());
832 } 832 }
833 833
834 } // namespace browser_sync 834 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698