| Index: net/proxy/mock_proxy_script_fetcher.cc
|
| diff --git a/net/proxy/mock_proxy_script_fetcher.cc b/net/proxy/mock_proxy_script_fetcher.cc
|
| index 9aeab1c450d5edf9d15aff326bbd6181b7c1f879..1e45c00fe90f2fa0a1bdde53554c0cd47f529a58 100644
|
| --- a/net/proxy/mock_proxy_script_fetcher.cc
|
| +++ b/net/proxy/mock_proxy_script_fetcher.cc
|
| @@ -5,6 +5,7 @@
|
| #include "net/proxy/mock_proxy_script_fetcher.h"
|
|
|
| #include "base/logging.h"
|
| +#include "base/message_loop.h"
|
| #include "base/string16.h"
|
| #include "base/utf_string_conversions.h"
|
| #include "net/base/net_errors.h"
|
| @@ -12,7 +13,8 @@
|
| namespace net {
|
|
|
| MockProxyScriptFetcher::MockProxyScriptFetcher()
|
| - : pending_request_text_(NULL) {
|
| + : pending_request_text_(NULL),
|
| + waiting_for_fetch_(false) {
|
| }
|
|
|
| MockProxyScriptFetcher::~MockProxyScriptFetcher() {}
|
| @@ -26,6 +28,10 @@ int MockProxyScriptFetcher::Fetch(const GURL& url, string16* text,
|
| pending_request_url_ = url;
|
| pending_request_callback_ = callback;
|
| pending_request_text_ = text;
|
| +
|
| + if (waiting_for_fetch_)
|
| + MessageLoop::current()->Quit();
|
| +
|
| return ERR_IO_PENDING;
|
| }
|
|
|
| @@ -53,4 +59,11 @@ bool MockProxyScriptFetcher::has_pending_request() const {
|
| return !pending_request_callback_.is_null();
|
| }
|
|
|
| +void MockProxyScriptFetcher::WaitUntilFetch() {
|
| + DCHECK(!has_pending_request());
|
| + waiting_for_fetch_ = true;
|
| + MessageLoop::current()->Run();
|
| + waiting_for_fetch_ = false;
|
| +}
|
| +
|
| } // namespace net
|
|
|