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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/search_engines/search_terms_data.h" | 9 #include "chrome/browser/search_engines/search_terms_data.h" |
10 #include "chrome/browser/search_engines/template_url.h" | 10 #include "chrome/browser/search_engines/template_url.h" |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1509 // deletion. | 1509 // deletion. |
1510 EXPECT_EQ(0U, model()->GetTemplateURLs().size()); | 1510 EXPECT_EQ(0U, model()->GetTemplateURLs().size()); |
1511 EXPECT_EQ(2U, processor()->change_list_size()); | 1511 EXPECT_EQ(2U, processor()->change_list_size()); |
1512 ASSERT_TRUE(processor()->contains_guid("key1")); | 1512 ASSERT_TRUE(processor()->contains_guid("key1")); |
1513 EXPECT_EQ(SyncChange::ACTION_DELETE, | 1513 EXPECT_EQ(SyncChange::ACTION_DELETE, |
1514 processor()->change_for_guid("key1").change_type()); | 1514 processor()->change_for_guid("key1").change_type()); |
1515 ASSERT_TRUE(processor()->contains_guid(std::string())); | 1515 ASSERT_TRUE(processor()->contains_guid(std::string())); |
1516 EXPECT_EQ(SyncChange::ACTION_DELETE, | 1516 EXPECT_EQ(SyncChange::ACTION_DELETE, |
1517 processor()->change_for_guid(std::string()).change_type()); | 1517 processor()->change_for_guid(std::string()).change_type()); |
1518 } | 1518 } |
1519 | |
1520 TEST_F(TemplateURLServiceSyncTest, PreSyncDeletes) { | |
1521 model()->AddPreSyncDeletedGUIDForTesting("key1"); | |
1522 model()->AddPreSyncDeletedGUIDForTesting("key2"); | |
1523 model()->AddPreSyncDeletedGUIDForTesting("aaa"); | |
1524 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("whatever"), | |
1525 "http://key1.com", "bbb")); | |
1526 model()->MergeDataAndStartSyncing(syncable::SEARCH_ENGINES, | |
1527 CreateInitialSyncData(), PassProcessor(), | |
1528 CreateAndPassSyncErrorFactory()); | |
1529 | |
1530 // We expect the model to have GUIDs {bbb, key3} after our initial merge. | |
1531 EXPECT_TRUE(model()->GetTemplateURLForGUID("bbb")); | |
1532 EXPECT_TRUE(model()->GetTemplateURLForGUID("key3")); | |
1533 SyncChange change = processor()->change_for_guid("key1"); | |
1534 EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type()); | |
1535 change = processor()->change_for_guid("key2"); | |
1536 EXPECT_EQ(SyncChange::ACTION_DELETE, change.change_type()); | |
1537 // "aaa" should have been pruned out on account of not being from Sync. | |
1538 EXPECT_FALSE(processor()->contains_guid("aaa")); | |
1539 } | |
Peter Kasting
2012/05/15 21:28:10
Can we also explicitly check that a pre-sync delet
SteveT
2012/05/16 13:26:43
I believe that is done with the "aaa" case. See li
| |
OLD | NEW |