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

Side by Side Diff: components/search_engines/template_url_service_sync_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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
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/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 7 #include "base/run_loop.h"
9 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
11 #include "base/time/time.h" 10 #include "base/time/time.h"
12 #include "chrome/browser/search_engines/template_url_service_test_util.h" 11 #include "chrome/browser/search_engines/template_url_service_test_util.h"
13 #include "chrome/test/base/testing_pref_service_syncable.h" 12 #include "chrome/test/base/testing_pref_service_syncable.h"
14 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
15 #include "components/search_engines/search_engines_pref_names.h" 14 #include "components/search_engines/search_engines_pref_names.h"
16 #include "components/search_engines/search_terms_data.h" 15 #include "components/search_engines/search_terms_data.h"
17 #include "components/search_engines/template_url.h" 16 #include "components/search_engines/template_url.h"
18 #include "components/search_engines/template_url_prepopulate_data.h" 17 #include "components/search_engines/template_url_prepopulate_data.h"
19 #include "components/search_engines/template_url_service.h" 18 #include "components/search_engines/template_url_service.h"
20 #include "components/search_engines/template_url_service_client.h" 19 #include "components/search_engines/template_url_service_client.h"
20 #include "content/public/test/test_browser_thread_bundle.h"
21 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
22 #include "sync/api/sync_change_processor_wrapper_for_test.h" 22 #include "sync/api/sync_change_processor_wrapper_for_test.h"
23 #include "sync/api/sync_error_factory.h" 23 #include "sync/api/sync_error_factory.h"
24 #include "sync/api/sync_error_factory_mock.h" 24 #include "sync/api/sync_error_factory_mock.h"
25 #include "sync/protocol/search_engine_specifics.pb.h" 25 #include "sync/protocol/search_engine_specifics.pb.h"
26 #include "sync/protocol/sync.pb.h" 26 #include "sync/protocol/sync.pb.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 using base::ASCIIToUTF16; 29 using base::ASCIIToUTF16;
30 using base::UTF8ToUTF16; 30 using base::UTF8ToUTF16;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 230
231 // Creates a new TemplateURL copying the fields of |turl| but replacing 231 // Creates a new TemplateURL copying the fields of |turl| but replacing
232 // the |url| and |guid| and initializing the date_created and last_modified 232 // the |url| and |guid| and initializing the date_created and last_modified
233 // timestamps to a default value of 100. The caller owns the returned 233 // timestamps to a default value of 100. The caller owns the returned
234 // TemplateURL*. 234 // TemplateURL*.
235 TemplateURL* CopyTemplateURL(const TemplateURLData* turl, 235 TemplateURL* CopyTemplateURL(const TemplateURLData* turl,
236 const std::string& url, 236 const std::string& url,
237 const std::string& guid); 237 const std::string& guid);
238 238
239 protected: 239 protected:
240 base::MessageLoop message_loop_; 240 content::TestBrowserThreadBundle thread_bundle_;
241 // We keep two TemplateURLServices to test syncing between them. 241 // We keep two TemplateURLServices to test syncing between them.
242 scoped_ptr<TemplateURLServiceTestUtil> test_util_a_; 242 scoped_ptr<TemplateURLServiceTestUtil> test_util_a_;
243 scoped_ptr<TemplateURLServiceTestUtil> test_util_b_; 243 scoped_ptr<TemplateURLServiceTestUtil> test_util_b_;
244 244
245 // Our dummy ChangeProcessor used to inspect changes pushed to Sync. 245 // Our dummy ChangeProcessor used to inspect changes pushed to Sync.
246 scoped_ptr<TestChangeProcessor> sync_processor_; 246 scoped_ptr<TestChangeProcessor> sync_processor_;
247 scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> sync_processor_wrapper_; 247 scoped_ptr<syncer::SyncChangeProcessorWrapperForTest> sync_processor_wrapper_;
248 248
249 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest); 249 DISALLOW_COPY_AND_ASSIGN(TemplateURLServiceSyncTest);
250 }; 250 };
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2260 const char kNewGUID[] = "newdefault"; 2260 const char kNewGUID[] = "newdefault";
2261 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"), 2261 model()->Add(CreateTestTemplateURL(ASCIIToUTF16("what"),
2262 "http://thewhat.com/{searchTerms}", 2262 "http://thewhat.com/{searchTerms}",
2263 kNewGUID)); 2263 kNewGUID));
2264 model()->SetUserSelectedDefaultSearchProvider( 2264 model()->SetUserSelectedDefaultSearchProvider(
2265 model()->GetTemplateURLForGUID(kNewGUID)); 2265 model()->GetTemplateURLForGUID(kNewGUID));
2266 2266
2267 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString( 2267 EXPECT_EQ(kNewGUID, profile_a()->GetTestingPrefService()->GetString(
2268 prefs::kSyncedDefaultSearchProviderGUID)); 2268 prefs::kSyncedDefaultSearchProviderGUID));
2269 } 2269 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698