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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 } | 1006 } |
1007 | 1007 |
1008 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed | 1008 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed |
1009 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MissingHeaderAndTab) { | 1009 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MissingHeaderAndTab) { |
1010 AddTab(browser(), GURL("http://foo1")); | 1010 AddTab(browser(), GURL("http://foo1")); |
1011 NavigateAndCommitActiveTab(GURL("http://foo2")); | 1011 NavigateAndCommitActiveTab(GURL("http://foo2")); |
1012 AddTab(browser(), GURL("http://bar1")); | 1012 AddTab(browser(), GURL("http://bar1")); |
1013 NavigateAndCommitActiveTab(GURL("http://bar2")); | 1013 NavigateAndCommitActiveTab(GURL("http://bar2")); |
1014 CreateRootHelper create_root(this); | 1014 CreateRootHelper create_root(this); |
1015 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); | 1015 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); |
1016 SyncError error; | 1016 csync::SyncError error; |
1017 std::string local_tag = model_associator_->GetCurrentMachineTag(); | 1017 std::string local_tag = model_associator_->GetCurrentMachineTag(); |
1018 | 1018 |
1019 error = model_associator_->DisassociateModels(); | 1019 error = model_associator_->DisassociateModels(); |
1020 ASSERT_FALSE(error.IsSet()); | 1020 ASSERT_FALSE(error.IsSet()); |
1021 { | 1021 { |
1022 // Create a sync node with the local tag but neither header nor tab field. | 1022 // Create a sync node with the local tag but neither header nor tab field. |
1023 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1023 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1024 csync::ReadNode root(&trans); | 1024 csync::ReadNode root(&trans); |
1025 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); | 1025 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); |
1026 csync::WriteNode extra_header(&trans); | 1026 csync::WriteNode extra_header(&trans); |
(...skipping 10 matching lines...) Expand all Loading... |
1037 } | 1037 } |
1038 | 1038 |
1039 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed | 1039 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed |
1040 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MultipleHeaders) { | 1040 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MultipleHeaders) { |
1041 AddTab(browser(), GURL("http://foo1")); | 1041 AddTab(browser(), GURL("http://foo1")); |
1042 NavigateAndCommitActiveTab(GURL("http://foo2")); | 1042 NavigateAndCommitActiveTab(GURL("http://foo2")); |
1043 AddTab(browser(), GURL("http://bar1")); | 1043 AddTab(browser(), GURL("http://bar1")); |
1044 NavigateAndCommitActiveTab(GURL("http://bar2")); | 1044 NavigateAndCommitActiveTab(GURL("http://bar2")); |
1045 CreateRootHelper create_root(this); | 1045 CreateRootHelper create_root(this); |
1046 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); | 1046 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); |
1047 SyncError error; | 1047 csync::SyncError error; |
1048 std::string local_tag = model_associator_->GetCurrentMachineTag(); | 1048 std::string local_tag = model_associator_->GetCurrentMachineTag(); |
1049 | 1049 |
1050 error = model_associator_->DisassociateModels(); | 1050 error = model_associator_->DisassociateModels(); |
1051 ASSERT_FALSE(error.IsSet()); | 1051 ASSERT_FALSE(error.IsSet()); |
1052 { | 1052 { |
1053 // Create another sync node with a header field and the local tag. | 1053 // Create another sync node with a header field and the local tag. |
1054 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1054 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1055 csync::ReadNode root(&trans); | 1055 csync::ReadNode root(&trans); |
1056 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); | 1056 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); |
1057 csync::WriteNode extra_header(&trans); | 1057 csync::WriteNode extra_header(&trans); |
(...skipping 11 matching lines...) Expand all Loading... |
1069 } | 1069 } |
1070 | 1070 |
1071 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed | 1071 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed |
1072 TEST_F(ProfileSyncServiceSessionTest, DISABLED_CorruptedForeign) { | 1072 TEST_F(ProfileSyncServiceSessionTest, DISABLED_CorruptedForeign) { |
1073 AddTab(browser(), GURL("http://foo1")); | 1073 AddTab(browser(), GURL("http://foo1")); |
1074 NavigateAndCommitActiveTab(GURL("http://foo2")); | 1074 NavigateAndCommitActiveTab(GURL("http://foo2")); |
1075 AddTab(browser(), GURL("http://bar1")); | 1075 AddTab(browser(), GURL("http://bar1")); |
1076 NavigateAndCommitActiveTab(GURL("http://bar2")); | 1076 NavigateAndCommitActiveTab(GURL("http://bar2")); |
1077 CreateRootHelper create_root(this); | 1077 CreateRootHelper create_root(this); |
1078 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); | 1078 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); |
1079 SyncError error; | 1079 csync::SyncError error; |
1080 | 1080 |
1081 error = model_associator_->DisassociateModels(); | 1081 error = model_associator_->DisassociateModels(); |
1082 ASSERT_FALSE(error.IsSet()); | 1082 ASSERT_FALSE(error.IsSet()); |
1083 { | 1083 { |
1084 // Create another sync node with neither header nor tab field and a foreign | 1084 // Create another sync node with neither header nor tab field and a foreign |
1085 // tag. | 1085 // tag. |
1086 std::string foreign_tag = "foreign_tag"; | 1086 std::string foreign_tag = "foreign_tag"; |
1087 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1087 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1088 csync::ReadNode root(&trans); | 1088 csync::ReadNode root(&trans); |
1089 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); | 1089 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); |
(...skipping 12 matching lines...) Expand all Loading... |
1102 | 1102 |
1103 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed | 1103 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed |
1104 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MissingLocalTabNode) { | 1104 TEST_F(ProfileSyncServiceSessionTest, DISABLED_MissingLocalTabNode) { |
1105 AddTab(browser(), GURL("http://foo1")); | 1105 AddTab(browser(), GURL("http://foo1")); |
1106 NavigateAndCommitActiveTab(GURL("http://foo2")); | 1106 NavigateAndCommitActiveTab(GURL("http://foo2")); |
1107 AddTab(browser(), GURL("http://bar1")); | 1107 AddTab(browser(), GURL("http://bar1")); |
1108 NavigateAndCommitActiveTab(GURL("http://bar2")); | 1108 NavigateAndCommitActiveTab(GURL("http://bar2")); |
1109 CreateRootHelper create_root(this); | 1109 CreateRootHelper create_root(this); |
1110 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); | 1110 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); |
1111 std::string local_tag = model_associator_->GetCurrentMachineTag(); | 1111 std::string local_tag = model_associator_->GetCurrentMachineTag(); |
1112 SyncError error; | 1112 csync::SyncError error; |
1113 | 1113 |
1114 error = model_associator_->DisassociateModels(); | 1114 error = model_associator_->DisassociateModels(); |
1115 ASSERT_FALSE(error.IsSet()); | 1115 ASSERT_FALSE(error.IsSet()); |
1116 { | 1116 { |
1117 // Delete the first sync tab node. | 1117 // Delete the first sync tab node. |
1118 std::string tab_tag = SessionModelAssociator::TabIdToTag(local_tag, 0); | 1118 std::string tab_tag = SessionModelAssociator::TabIdToTag(local_tag, 0); |
1119 | 1119 |
1120 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1120 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1121 csync::ReadNode root(&trans); | 1121 csync::ReadNode root(&trans); |
1122 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); | 1122 root.InitByTagLookup(syncable::ModelTypeToRootTag(syncable::SESSIONS)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1175 | 1175 |
1176 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed | 1176 // TODO(jhorwich): Re-enable when crbug.com/121487 addressed |
1177 TEST_F(ProfileSyncServiceSessionTest, DISABLED_CorruptedLocalHeader) { | 1177 TEST_F(ProfileSyncServiceSessionTest, DISABLED_CorruptedLocalHeader) { |
1178 AddTab(browser(), GURL("http://foo1")); | 1178 AddTab(browser(), GURL("http://foo1")); |
1179 NavigateAndCommitActiveTab(GURL("http://foo2")); | 1179 NavigateAndCommitActiveTab(GURL("http://foo2")); |
1180 AddTab(browser(), GURL("http://bar1")); | 1180 AddTab(browser(), GURL("http://bar1")); |
1181 NavigateAndCommitActiveTab(GURL("http://bar2")); | 1181 NavigateAndCommitActiveTab(GURL("http://bar2")); |
1182 CreateRootHelper create_root(this); | 1182 CreateRootHelper create_root(this); |
1183 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); | 1183 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); |
1184 std::string local_tag = model_associator_->GetCurrentMachineTag(); | 1184 std::string local_tag = model_associator_->GetCurrentMachineTag(); |
1185 SyncError error; | 1185 csync::SyncError error; |
1186 | 1186 |
1187 error = model_associator_->DisassociateModels(); | 1187 error = model_associator_->DisassociateModels(); |
1188 ASSERT_FALSE(error.IsSet()); | 1188 ASSERT_FALSE(error.IsSet()); |
1189 { | 1189 { |
1190 // Load the header node and clear it. | 1190 // Load the header node and clear it. |
1191 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 1191 csync::WriteTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
1192 csync::WriteNode header(&trans); | 1192 csync::WriteNode header(&trans); |
1193 ASSERT_EQ(csync::BaseNode::INIT_OK, | 1193 ASSERT_EQ(csync::BaseNode::INIT_OK, |
1194 header.InitByClientTagLookup(syncable::SESSIONS, local_tag)); | 1194 header.InitByClientTagLookup(syncable::SESSIONS, local_tag)); |
1195 sync_pb::SessionSpecifics specifics; | 1195 sync_pb::SessionSpecifics specifics; |
1196 header.SetSessionSpecifics(specifics); | 1196 header.SetSessionSpecifics(specifics); |
1197 } | 1197 } |
1198 // Ensure we associate properly despite the pre-existing node with our local | 1198 // Ensure we associate properly despite the pre-existing node with our local |
1199 // tag. | 1199 // tag. |
1200 error = model_associator_->AssociateModels(); | 1200 error = model_associator_->AssociateModels(); |
1201 ASSERT_FALSE(error.IsSet()); | 1201 ASSERT_FALSE(error.IsSet()); |
1202 } | 1202 } |
1203 | 1203 |
1204 } // namespace browser_sync | 1204 } // namespace browser_sync |
OLD | NEW |