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

Side by Side Diff: chrome/browser/search_engines/template_url_service_sync_unittest.cc

Issue 10033017: More misc. cleanups to minimize future refactoring diffs. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: 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 "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/template_url.h" 9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/search_engines/template_url_service.h" 10 #include "chrome/browser/search_engines/template_url_service.h"
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 784
785 // The key1 duplicate results in Sync's copy winning. Ensure that Sync's 785 // The key1 duplicate results in Sync's copy winning. Ensure that Sync's
786 // copy replaced the local copy. 786 // copy replaced the local copy.
787 EXPECT_TRUE(model()->GetTemplateURLForGUID("key1")); 787 EXPECT_TRUE(model()->GetTemplateURLForGUID("key1"));
788 EXPECT_FALSE(model()->GetTemplateURLForGUID("aaa")); 788 EXPECT_FALSE(model()->GetTemplateURLForGUID("aaa"));
789 789
790 // The key2 keyword conflict results in Sync's copy winning, so ensure it 790 // The key2 keyword conflict results in Sync's copy winning, so ensure it
791 // retains the original keyword. The local copy should get a uniquified 791 // retains the original keyword. The local copy should get a uniquified
792 // keyword. Both TemplateURLs should be found locally. 792 // keyword. Both TemplateURLs should be found locally.
793 const TemplateURL* key2_sync = model()->GetTemplateURLForGUID("key2"); 793 const TemplateURL* key2_sync = model()->GetTemplateURLForGUID("key2");
794 EXPECT_TRUE(key2_sync); 794 ASSERT_TRUE(key2_sync);
795 EXPECT_EQ(ASCIIToUTF16("key2"), key2_sync->keyword()); 795 EXPECT_EQ(ASCIIToUTF16("key2"), key2_sync->keyword());
796 const TemplateURL* key2_local = model()->GetTemplateURLForGUID("bbb"); 796 const TemplateURL* key2_local = model()->GetTemplateURLForGUID("bbb");
797 EXPECT_TRUE(key2_local); 797 ASSERT_TRUE(key2_local);
798 EXPECT_EQ(ASCIIToUTF16("expected.com"), key2_local->keyword()); 798 EXPECT_EQ(ASCIIToUTF16("expected.com"), key2_local->keyword());
799 799
800 // The last TemplateURL should have had no conflicts and was just added. It 800 // The last TemplateURL should have had no conflicts and was just added. It
801 // should not have replaced the third local TemplateURL. 801 // should not have replaced the third local TemplateURL.
802 EXPECT_TRUE(model()->GetTemplateURLForGUID("ccc")); 802 EXPECT_TRUE(model()->GetTemplateURLForGUID("ccc"));
803 EXPECT_TRUE(model()->GetTemplateURLForGUID("key3")); 803 EXPECT_TRUE(model()->GetTemplateURLForGUID("key3"));
804 804
805 // Two ADDs. 805 // Two ADDs.
806 EXPECT_EQ(2, processor()->change_list_size()); 806 EXPECT_EQ(2, processor()->change_list_size());
807 // Two ADDs should be pushed up to Sync. 807 // Two ADDs should be pushed up to Sync.
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 1288
1289 // The key1 entry should be a duplicate of the default. 1289 // The key1 entry should be a duplicate of the default.
1290 model()->MergeDataAndStartSyncing(syncable::SEARCH_ENGINES, 1290 model()->MergeDataAndStartSyncing(syncable::SEARCH_ENGINES,
1291 CreateInitialSyncData(), PassProcessor()); 1291 CreateInitialSyncData(), PassProcessor());
1292 1292
1293 EXPECT_EQ(3U, model()->GetAllSyncData(syncable::SEARCH_ENGINES).size()); 1293 EXPECT_EQ(3U, model()->GetAllSyncData(syncable::SEARCH_ENGINES).size());
1294 EXPECT_FALSE(model()->GetTemplateURLForGUID("whateverguid")); 1294 EXPECT_FALSE(model()->GetTemplateURLForGUID("whateverguid"));
1295 EXPECT_EQ(model()->GetDefaultSearchProvider(), 1295 EXPECT_EQ(model()->GetDefaultSearchProvider(),
1296 model()->GetTemplateURLForGUID("key1")); 1296 model()->GetTemplateURLForGUID("key1"));
1297 } 1297 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698