Chromium Code Reviews| Index: chrome/browser/printing/print_dialog_cloud_interative_uitest.cc |
| diff --git a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc |
| index 4f67ada09a035181dfa244ac8d42367a4ab5b9ef..fc328fa08f2efac20018bc508cc829039d80e2dd 100644 |
| --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc |
| +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc |
| @@ -173,8 +173,9 @@ class PrintDialogCloudTest : public InProcessBrowserTest { |
| virtual void TearDown() { |
| if (handler_added_) { |
| - net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| - filter->RemoveHostnameHandler(scheme_, host_name_); |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
| + base::Bind(Unregister, scheme_, host_name_)); |
| handler_added_ = false; |
| TestController::GetInstance()->set_delegate(NULL); |
| } |
| @@ -187,14 +188,14 @@ class PrintDialogCloudTest : public InProcessBrowserTest { |
| // individual test functions seems to fix that. |
| void AddTestHandlers() { |
| if (!handler_added_) { |
| - net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); |
| GURL cloud_print_service_url = |
| CloudPrintURL(browser()->profile()). |
| GetCloudPrintServiceURL(); |
| scheme_ = cloud_print_service_url.scheme(); |
| host_name_ = cloud_print_service_url.host(); |
| - filter->AddHostnameHandler(scheme_, host_name_, |
| - &PrintDialogCloudTest::Factory); |
| + BrowserThread::PostTask( |
| + BrowserThread::IO, FROM_HERE, |
| + base::Bind(&PrintDialogCloudTest::Register, this)); |
| handler_added_ = true; |
| GURL cloud_print_dialog_url = |
| @@ -218,6 +219,17 @@ class PrintDialogCloudTest : public InProcessBrowserTest { |
| std::string("application/pdf"), false)); |
| } |
| + private: |
| + void Register() { |
|
mmenke
2012/12/13 16:12:04
Think that, out of a combination paranoia and desi
|
| + net::URLRequestFilter::GetInstance()->AddHostnameHandler( |
| + scheme_, host_name_, &PrintDialogCloudTest::Factory); |
| + } |
| + static void Unregister(const std::string& scheme, |
| + const std::string& host_name) { |
| + net::URLRequestFilter::GetInstance()->RemoveHostnameHandler(scheme, |
| + host_name); |
| + } |
| + |
| bool handler_added_; |
| std::string scheme_; |
| std::string host_name_; |