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

Side by Side Diff: chrome/browser/sync/profile_sync_service_session_unittest.cc

Issue 10152003: sync: Make BaseNode lookup-related Init functions return specific failures. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init Created 8 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 | 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 <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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 bool has_nodes; 308 bool has_nodes;
309 ASSERT_TRUE(model_associator_->SyncModelHasUserCreatedNodes(&has_nodes)); 309 ASSERT_TRUE(model_associator_->SyncModelHasUserCreatedNodes(&has_nodes));
310 ASSERT_TRUE(has_nodes); 310 ASSERT_TRUE(has_nodes);
311 std::string machine_tag = model_associator_->GetCurrentMachineTag(); 311 std::string machine_tag = model_associator_->GetCurrentMachineTag();
312 int64 sync_id = model_associator_->GetSyncIdFromSessionTag(machine_tag); 312 int64 sync_id = model_associator_->GetSyncIdFromSessionTag(machine_tag);
313 ASSERT_NE(sync_api::kInvalidId, sync_id); 313 ASSERT_NE(sync_api::kInvalidId, sync_id);
314 314
315 // Check that we can get the correct session specifics back from the node. 315 // Check that we can get the correct session specifics back from the node.
316 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 316 sync_api::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
317 sync_api::ReadNode node(&trans); 317 sync_api::ReadNode node(&trans);
318 ASSERT_TRUE(node.InitByClientTagLookup(syncable::SESSIONS, machine_tag)); 318 ASSERT_EQ(sync_api::BaseNode::INIT_OK,
319 node.InitByClientTagLookup(syncable::SESSIONS, machine_tag));
319 const sync_pb::SessionSpecifics& specifics(node.GetSessionSpecifics()); 320 const sync_pb::SessionSpecifics& specifics(node.GetSessionSpecifics());
320 ASSERT_EQ(machine_tag, specifics.session_tag()); 321 ASSERT_EQ(machine_tag, specifics.session_tag());
321 ASSERT_TRUE(specifics.has_header()); 322 ASSERT_TRUE(specifics.has_header());
322 const sync_pb::SessionHeader& header_s = specifics.header(); 323 const sync_pb::SessionHeader& header_s = specifics.header();
323 ASSERT_TRUE(header_s.has_device_type()); 324 ASSERT_TRUE(header_s.has_device_type());
324 ASSERT_EQ("TestSessionName", header_s.client_name()); 325 ASSERT_EQ("TestSessionName", header_s.client_name());
325 ASSERT_EQ(0, header_s.window_size()); 326 ASSERT_EQ(0, header_s.window_size());
326 } 327 }
327 328
328 // Test that we can fill this machine's session, write it to a node, 329 // Test that we can fill this machine's session, write it to a node,
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 error = model_associator_->AssociateModels(); 1125 error = model_associator_->AssociateModels();
1125 ASSERT_FALSE(error.IsSet()); 1126 ASSERT_FALSE(error.IsSet());
1126 1127
1127 // Add some more tabs to ensure we don't conflict with the pre-existing tab 1128 // Add some more tabs to ensure we don't conflict with the pre-existing tab
1128 // node. 1129 // node.
1129 AddTab(browser(), GURL("http://baz1")); 1130 AddTab(browser(), GURL("http://baz1"));
1130 AddTab(browser(), GURL("http://baz2")); 1131 AddTab(browser(), GURL("http://baz2"));
1131 } 1132 }
1132 1133
1133 } // namespace browser_sync 1134 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698