Index: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
index 8b0e950cf9281e073f3517ddde5e8c104775a625..939374a232376657f7c7acf5215d5605302a520d 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc |
@@ -46,8 +46,9 @@ class TestDataReductionProxyAuthRequestHandler |
: public DataReductionProxyAuthRequestHandler { |
public: |
TestDataReductionProxyAuthRequestHandler( |
- DataReductionProxyParams* params) |
- : DataReductionProxyAuthRequestHandler(params) {} |
+ DataReductionProxyParams* params, |
+ base::MessageLoopProxy* loop_proxy) |
+ : DataReductionProxyAuthRequestHandler(params, loop_proxy) {} |
virtual std::string GetDefaultKey() const OVERRIDE { |
return kTestKey; |
@@ -68,6 +69,13 @@ class TestDataReductionProxyAuthRequestHandler |
} // namespace |
class DataReductionProxyAuthRequestHandlerTest : public testing::Test { |
+ public: |
+ DataReductionProxyAuthRequestHandlerTest() |
+ : loop_proxy_(base::MessageLoopProxy::current().get()) { |
+ } |
+ // Required for MessageLoopProxy::current(). |
+ base::MessageLoopForUI loop_; |
+ base::MessageLoopProxy* loop_proxy_; |
}; |
TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) { |
@@ -79,8 +87,10 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) { |
DataReductionProxyParams::kPromoAllowed, |
TestDataReductionProxyParams::HAS_EVERYTHING & |
~TestDataReductionProxyParams::HAS_DEV_ORIGIN)); |
- TestDataReductionProxyAuthRequestHandler auth_handler(params.get()); |
+ TestDataReductionProxyAuthRequestHandler auth_handler(params.get(), |
+ loop_proxy_); |
auth_handler.Init(); |
+ base::MessageLoop::current()->RunUntilIdle(); |
#if defined(OS_ANDROID) |
EXPECT_EQ(auth_handler.client_, "android"); |
#elif defined(OS_IOS) |
@@ -95,6 +105,7 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) { |
// Now set a key. |
auth_handler.SetKey(kTestKey2, kClient2, kVersion2); |
+ base::MessageLoop::current()->RunUntilIdle(); |
EXPECT_EQ(kClient2, auth_handler.client_); |
EXPECT_EQ(kVersion2, auth_handler.version_); |
EXPECT_EQ(kTestKey2, auth_handler.key_); |