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

Side by Side Diff: chrome/browser/sync/test/integration/sync_test.cc

Issue 2835503003: Replace SyncTest::SetUpInProcessBrowserTestFixture with SyncTest::SetUpOnMainThread. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/sync/test/integration/sync_test.h" 5 #include "chrome/browser/sync/test/integration/sync_test.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <limits> 10 #include <limits>
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "components/sync/test/fake_server/fake_server_network_resources.h" 75 #include "components/sync/test/fake_server/fake_server_network_resources.h"
76 #include "content/public/browser/navigation_entry.h" 76 #include "content/public/browser/navigation_entry.h"
77 #include "content/public/browser/notification_service.h" 77 #include "content/public/browser/notification_service.h"
78 #include "content/public/browser/web_contents.h" 78 #include "content/public/browser/web_contents.h"
79 #include "content/public/test/test_browser_thread.h" 79 #include "content/public/test/test_browser_thread.h"
80 #include "google_apis/gaia/gaia_urls.h" 80 #include "google_apis/gaia/gaia_urls.h"
81 #include "net/base/escape.h" 81 #include "net/base/escape.h"
82 #include "net/base/load_flags.h" 82 #include "net/base/load_flags.h"
83 #include "net/base/network_change_notifier.h" 83 #include "net/base/network_change_notifier.h"
84 #include "net/base/port_util.h" 84 #include "net/base/port_util.h"
85 #include "net/dns/mock_host_resolver.h"
85 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" 86 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
86 #include "net/url_request/test_url_fetcher_factory.h" 87 #include "net/url_request/test_url_fetcher_factory.h"
87 #include "net/url_request/url_fetcher.h" 88 #include "net/url_request/url_fetcher.h"
88 #include "net/url_request/url_fetcher_delegate.h" 89 #include "net/url_request/url_fetcher_delegate.h"
89 #include "url/gurl.h" 90 #include "url/gurl.h"
90 91
91 #if defined(OS_CHROMEOS) 92 #if defined(OS_CHROMEOS)
92 #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h" 93 #include "chrome/browser/sync/test/integration/sync_arc_package_helper.h"
93 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h" 94 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs_factory.h"
94 #include "chromeos/chromeos_switches.h" 95 #include "chromeos/chromeos_switches.h"
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 fake_server_->RemoveObserver(*it); 755 fake_server_->RemoveObserver(*it);
755 } 756 }
756 } 757 }
757 758
758 invalidation_forwarders_.clear(); 759 invalidation_forwarders_.clear();
759 sync_refreshers_.clear(); 760 sync_refreshers_.clear();
760 fake_server_invalidation_services_.clear(); 761 fake_server_invalidation_services_.clear();
761 clients_.clear(); 762 clients_.clear();
762 } 763 }
763 764
764 void SyncTest::SetUpInProcessBrowserTestFixture() { 765 void SyncTest::SetUpOnMainThread() {
765 // We don't take a reference to |resolver|, but mock_host_resolver_override_ 766 host_resolver()->AllowDirectLookup("*.google.com");
766 // does, so effectively assumes ownership.
767 net::RuleBasedHostResolverProc* resolver =
768 new net::RuleBasedHostResolverProc(host_resolver());
769 resolver->AllowDirectLookup("*.google.com");
770 767
771 // Allow connection to googleapis.com for oauth token requests in E2E tests. 768 // Allow connection to googleapis.com for oauth token requests in E2E tests.
772 resolver->AllowDirectLookup("*.googleapis.com"); 769 host_resolver()->AllowDirectLookup("*.googleapis.com");
773 770
774 // On Linux, we use Chromium's NSS implementation which uses the following 771 // On Linux, we use Chromium's NSS implementation which uses the following
775 // hosts for certificate verification. Without these overrides, running the 772 // hosts for certificate verification. Without these overrides, running the
776 // integration tests on Linux causes error as we make external DNS lookups. 773 // integration tests on Linux causes error as we make external DNS lookups.
777 resolver->AllowDirectLookup("*.thawte.com"); 774 host_resolver()->AllowDirectLookup("*.thawte.com");
778 resolver->AllowDirectLookup("*.geotrust.com"); 775 host_resolver()->AllowDirectLookup("*.geotrust.com");
779 resolver->AllowDirectLookup("*.gstatic.com"); 776 host_resolver()->AllowDirectLookup("*.gstatic.com");
780 mock_host_resolver_override_ =
781 base::MakeUnique<net::ScopedDefaultHostResolverProc>(resolver);
782 }
783
784 void SyncTest::TearDownInProcessBrowserTestFixture() {
785 mock_host_resolver_override_.reset();
786 } 777 }
787 778
788 void SyncTest::WaitForDataModels(Profile* profile) { 779 void SyncTest::WaitForDataModels(Profile* profile) {
789 bookmarks::test::WaitForBookmarkModelToLoad( 780 bookmarks::test::WaitForBookmarkModelToLoad(
790 BookmarkModelFactory::GetForBrowserContext(profile)); 781 BookmarkModelFactory::GetForBrowserContext(profile));
791 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile( 782 ui_test_utils::WaitForHistoryToLoad(HistoryServiceFactory::GetForProfile(
792 profile, ServiceAccessType::EXPLICIT_ACCESS)); 783 profile, ServiceAccessType::EXPLICIT_ACCESS));
793 search_test_utils::WaitForTemplateURLServiceToLoad( 784 search_test_utils::WaitForTemplateURLServiceToLoad(
794 TemplateURLServiceFactory::GetForProfile(profile)); 785 TemplateURLServiceFactory::GetForProfile(profile));
795 } 786 }
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) { 1212 bool SyncTest::ClearServerData(ProfileSyncServiceHarness* harness) {
1222 // At this point our birthday is good. 1213 // At this point our birthday is good.
1223 base::RunLoop run_loop; 1214 base::RunLoop run_loop;
1224 harness->service()->ClearServerDataForTest(run_loop.QuitClosure()); 1215 harness->service()->ClearServerDataForTest(run_loop.QuitClosure());
1225 run_loop.Run(); 1216 run_loop.Run();
1226 1217
1227 // Our birthday is invalidated on the server here so restart sync to get 1218 // Our birthday is invalidated on the server here so restart sync to get
1228 // the new birthday from the server. 1219 // the new birthday from the server.
1229 return harness->RestartSyncService(); 1220 return harness->RestartSyncService();
1230 } 1221 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698