| 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/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 1863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1874 | 1874 |
| 1875 // Merge the prepopulate search engines. | 1875 // Merge the prepopulate search engines. |
| 1876 base::Time pre_merge_time = base::Time::Now(); | 1876 base::Time pre_merge_time = base::Time::Now(); |
| 1877 base::RunLoop().RunUntilIdle(); | 1877 base::RunLoop().RunUntilIdle(); |
| 1878 test_util_a_.ResetModel(true); | 1878 test_util_a_.ResetModel(true); |
| 1879 | 1879 |
| 1880 // The newly added search engine should have been safely merged, with an | 1880 // The newly added search engine should have been safely merged, with an |
| 1881 // updated time. | 1881 // updated time. |
| 1882 TemplateURL* added_turl = model()->GetTemplateURLForKeyword( | 1882 TemplateURL* added_turl = model()->GetTemplateURLForKeyword( |
| 1883 ASCIIToUTF16(kNewKeyword)); | 1883 ASCIIToUTF16(kNewKeyword)); |
| 1884 ASSERT_TRUE(added_turl); |
| 1884 base::Time new_timestamp = added_turl->last_modified(); | 1885 base::Time new_timestamp = added_turl->last_modified(); |
| 1885 EXPECT_GE(new_timestamp, pre_merge_time); | 1886 EXPECT_GE(new_timestamp, pre_merge_time); |
| 1886 ASSERT_TRUE(added_turl); | |
| 1887 std::string sync_guid = added_turl->sync_guid(); | 1887 std::string sync_guid = added_turl->sync_guid(); |
| 1888 | 1888 |
| 1889 // Bring down a copy of the prepopulate engine from Sync with the old values, | 1889 // Bring down a copy of the prepopulate engine from Sync with the old values, |
| 1890 // including the old timestamp and the same GUID. Ensure that it loses | 1890 // including the old timestamp and the same GUID. Ensure that it loses |
| 1891 // conflict resolution against the local value, and an update is sent to the | 1891 // conflict resolution against the local value, and an update is sent to the |
| 1892 // server. The new timestamp should be preserved. | 1892 // server. The new timestamp should be preserved. |
| 1893 syncer::SyncDataList initial_data; | 1893 syncer::SyncDataList initial_data; |
| 1894 data_copy.SetKeyword(original_keyword); | 1894 data_copy.SetKeyword(original_keyword); |
| 1895 data_copy.sync_guid = sync_guid; | 1895 data_copy.sync_guid = sync_guid; |
| 1896 scoped_ptr<TemplateURL> sync_turl(new TemplateURL(profile_a(), data_copy)); | 1896 scoped_ptr<TemplateURL> sync_turl(new TemplateURL(profile_a(), data_copy)); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( | 2242 syncer::SyncMergeResult merge_result = model()->MergeDataAndStartSyncing( |
| 2243 syncer::SEARCH_ENGINES, list, PassProcessor(), | 2243 syncer::SEARCH_ENGINES, list, PassProcessor(), |
| 2244 CreateAndPassSyncErrorFactory()); | 2244 CreateAndPassSyncErrorFactory()); |
| 2245 | 2245 |
| 2246 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); | 2246 const TemplateURL* result_turl = model()->GetTemplateURLForGUID("default"); |
| 2247 EXPECT_TRUE(result_turl); | 2247 EXPECT_TRUE(result_turl); |
| 2248 EXPECT_EQ(default_turl->keyword(), result_turl->keyword()); | 2248 EXPECT_EQ(default_turl->keyword(), result_turl->keyword()); |
| 2249 EXPECT_EQ(default_turl->short_name, result_turl->short_name()); | 2249 EXPECT_EQ(default_turl->short_name, result_turl->short_name()); |
| 2250 EXPECT_EQ(default_turl->url(), result_turl->url()); | 2250 EXPECT_EQ(default_turl->url(), result_turl->url()); |
| 2251 } | 2251 } |
| OLD | NEW |