| 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..071c9b83d1317a5f3ca8e07b6877db88762fbd30 100644
|
| --- a/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
|
| +++ b/chrome/browser/printing/print_dialog_cloud_interative_uitest.cc
|
| @@ -166,15 +166,16 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
|
| }
|
| };
|
|
|
| - virtual void SetUp() {
|
| + virtual void SetUp() OVERRIDE {
|
| TestController::GetInstance()->set_result(false);
|
| InProcessBrowserTest::SetUp();
|
| }
|
|
|
| - virtual void TearDown() {
|
| + virtual void TearDown() OVERRIDE {
|
| if (handler_added_) {
|
| - net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
|
| - filter->RemoveHostnameHandler(scheme_, host_name_);
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE,
|
| + base::Bind(UnregisterTestHandlers, 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(RegisterTestHandlers, scheme_, host_name_));
|
| handler_added_ = true;
|
|
|
| GURL cloud_print_dialog_url =
|
| @@ -218,6 +219,18 @@ class PrintDialogCloudTest : public InProcessBrowserTest {
|
| std::string("application/pdf"), false));
|
| }
|
|
|
| + private:
|
| + static void RegisterTestHandlers(const std::string& scheme,
|
| + const std::string& host_name) {
|
| + net::URLRequestFilter::GetInstance()->AddHostnameHandler(
|
| + scheme, host_name, &PrintDialogCloudTest::Factory);
|
| + }
|
| + static void UnregisterTestHandlers(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_;
|
|
|