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/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/search_engines/search_terms_data.h" | 10 #include "chrome/browser/search_engines/search_terms_data.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 324 } |
325 EXPECT_EQ(0U, map2.size()); | 325 EXPECT_EQ(0U, map2.size()); |
326 } | 326 } |
327 | 327 |
328 syncer::SyncChange TemplateURLServiceSyncTest::CreateTestSyncChange( | 328 syncer::SyncChange TemplateURLServiceSyncTest::CreateTestSyncChange( |
329 syncer::SyncChange::SyncChangeType type, | 329 syncer::SyncChange::SyncChangeType type, |
330 TemplateURL* turl) const { | 330 TemplateURL* turl) const { |
331 // We take control of the TemplateURL so make sure it's cleaned up after | 331 // We take control of the TemplateURL so make sure it's cleaned up after |
332 // we create data out of it. | 332 // we create data out of it. |
333 scoped_ptr<TemplateURL> scoped_turl(turl); | 333 scoped_ptr<TemplateURL> scoped_turl(turl); |
334 return syncer::SyncChange( | 334 return syncer::SyncChange(type, |
335 FROM_HERE, | |
336 type, | |
337 TemplateURLService::CreateSyncDataFromTemplateURL(*scoped_turl)); | 335 TemplateURLService::CreateSyncDataFromTemplateURL(*scoped_turl)); |
338 } | 336 } |
339 | 337 |
340 syncer::SyncDataList TemplateURLServiceSyncTest::CreateInitialSyncData() const { | 338 syncer::SyncDataList TemplateURLServiceSyncTest::CreateInitialSyncData() const { |
341 syncer::SyncDataList list; | 339 syncer::SyncDataList list; |
342 | 340 |
343 scoped_ptr<TemplateURL> turl(CreateTestTemplateURL(ASCIIToUTF16("key1"), | 341 scoped_ptr<TemplateURL> turl(CreateTestTemplateURL(ASCIIToUTF16("key1"), |
344 "http://key1.com", "key1", 90)); | 342 "http://key1.com", "key1", 90)); |
345 list.push_back(TemplateURLService::CreateSyncDataFromTemplateURL(*turl)); | 343 list.push_back(TemplateURLService::CreateSyncDataFromTemplateURL(*turl)); |
346 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), "http://key2.com", | 344 turl.reset(CreateTestTemplateURL(ASCIIToUTF16("key2"), "http://key2.com", |
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2005 // A local change to the Google base URL should update the keyword and | 2003 // A local change to the Google base URL should update the keyword and |
2006 // generate a sync change. | 2004 // generate a sync change. |
2007 test_util_a_.SetGoogleBaseURL(GURL("http://google.co.in/")); | 2005 test_util_a_.SetGoogleBaseURL(GURL("http://google.co.in/")); |
2008 EXPECT_EQ(ASCIIToUTF16("google.co.in"), synced_turl->keyword()); | 2006 EXPECT_EQ(ASCIIToUTF16("google.co.in"), synced_turl->keyword()); |
2009 EXPECT_EQ(1U, processor()->change_list_size()); | 2007 EXPECT_EQ(1U, processor()->change_list_size()); |
2010 ASSERT_TRUE(processor()->contains_guid("guid")); | 2008 ASSERT_TRUE(processor()->contains_guid("guid")); |
2011 syncer::SyncChange change(processor()->change_for_guid("guid")); | 2009 syncer::SyncChange change(processor()->change_for_guid("guid")); |
2012 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); | 2010 EXPECT_EQ(syncer::SyncChange::ACTION_UPDATE, change.change_type()); |
2013 EXPECT_EQ("google.co.in", GetKeyword(change.sync_data())); | 2011 EXPECT_EQ("google.co.in", GetKeyword(change.sync_data())); |
2014 } | 2012 } |
OLD | NEW |