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

Unified Diff: chrome/browser/printing/print_dialog_cloud_interative_uitest.cc

Issue 11293252: Change Interceptors into URLRequestJobFactory::ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync (including tedv's change) Created 8 years 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 side-by-side diff with in-line comments
Download patch
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..001bc4a5b6bd4cc6efd580ef24994e6c4357a1a8 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(Register, 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 Register(const std::string& scheme,
mmenke 2012/12/18 20:32:15 Think these names are a little too vague. Just Re
+ const std::string& host_name) {
+ 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_;

Powered by Google App Engine
This is Rietveld 408576698