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

Side by Side Diff: chrome/browser/profiles/profile_browsertest.cc

Issue 2611053003: Flush TaskScheduler in ProfileBrowserTest.*. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/json/json_reader.h" 14 #include "base/json/json_reader.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/sequenced_task_runner.h" 19 #include "base/sequenced_task_runner.h"
20 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
21 #include "base/task_scheduler/task_scheduler.h"
21 #include "base/values.h" 22 #include "base/values.h"
22 #include "base/version.h" 23 #include "base/version.h"
23 #include "build/build_config.h" 24 #include "build/build_config.h"
24 #include "chrome/browser/browser_process.h" 25 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chrome_notification_types.h" 26 #include "chrome/browser/chrome_notification_types.h"
26 #include "chrome/browser/net/url_request_mock_util.h" 27 #include "chrome/browser/net/url_request_mock_util.h"
27 #include "chrome/browser/profiles/chrome_version_service.h" 28 #include "chrome/browser/profiles/chrome_version_service.h"
28 #include "chrome/browser/profiles/profile_impl.h" 29 #include "chrome/browser/profiles/profile_impl.h"
29 #include "chrome/browser/profiles/profile_manager.h" 30 #include "chrome/browser/profiles/profile_manager.h"
30 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 146 }
146 147
147 void SpinThreads() { 148 void SpinThreads() {
148 // Give threads a chance to do their stuff before shutting down (i.e. 149 // Give threads a chance to do their stuff before shutting down (i.e.
149 // deleting scoped temp dir etc). 150 // deleting scoped temp dir etc).
150 // Should not be necessary anymore once Profile deletion is fixed 151 // Should not be necessary anymore once Profile deletion is fixed
151 // (see crbug.com/88586). 152 // (see crbug.com/88586).
152 content::RunAllPendingInMessageLoop(); 153 content::RunAllPendingInMessageLoop();
153 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); 154 content::RunAllPendingInMessageLoop(content::BrowserThread::DB);
154 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 155 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
156
157 // This prevents HistoryBackend from accessing its databases after the
158 // directory that contains them has been deleted.
159 base::TaskScheduler::GetInstance()->FlushForTesting();
155 } 160 }
156 161
157 // Sends an HttpResponse for requests for "/" that result in sending an HPKP 162 // Sends an HttpResponse for requests for "/" that result in sending an HPKP
158 // report. Ignores other paths to avoid catching the subsequent favicon 163 // report. Ignores other paths to avoid catching the subsequent favicon
159 // request. 164 // request.
160 std::unique_ptr<net::test_server::HttpResponse> SendReportHttpResponse( 165 std::unique_ptr<net::test_server::HttpResponse> SendReportHttpResponse(
161 const GURL& report_url, 166 const GURL& report_url,
162 const net::test_server::HttpRequest& request) { 167 const net::test_server::HttpRequest& request) {
163 if (request.relative_url == "/") { 168 if (request.relative_url == "/") {
164 std::unique_ptr<net::test_server::BasicHttpResponse> response( 169 std::unique_ptr<net::test_server::BasicHttpResponse> response(
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url())); 842 base::Bind(&SendReportHttpResponse, embedded_test_server()->base_url()));
838 ASSERT_TRUE(hpkp_test_server.Start()); 843 ASSERT_TRUE(hpkp_test_server.Start());
839 844
840 // To send a report, must use a non-numeric host name for the original 845 // To send a report, must use a non-numeric host name for the original
841 // request. This must not match the host name of the server that reports are 846 // request. This must not match the host name of the server that reports are
842 // sent to. 847 // sent to.
843 ui_test_utils::NavigateToURL(browser(), 848 ui_test_utils::NavigateToURL(browser(),
844 hpkp_test_server.GetURL("localhost", "/")); 849 hpkp_test_server.GetURL("localhost", "/"));
845 wait_for_report_loop.Run(); 850 wait_for_report_loop.Run();
846 } 851 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698