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..dd76866236f41ef837a8b466fb51272a5053aa6a 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 |
@@ -7,6 +7,7 @@ |
#include "base/md5.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/run_loop.h" |
#include "base/strings/string16.h" |
#include "base/strings/utf_string_conversions.h" |
#include "base/time/time.h" |
@@ -46,8 +47,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 +70,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 +88,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::RunLoop().RunUntilIdle(); |
#if defined(OS_ANDROID) |
EXPECT_EQ(auth_handler.client_, "android"); |
#elif defined(OS_IOS) |
@@ -94,7 +105,8 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) { |
EXPECT_EQ(kExpectedSession, auth_handler.session_); |
// Now set a key. |
- auth_handler.SetKey(kTestKey2, kClient2, kVersion2); |
+ auth_handler.SetKeyOnUI(kTestKey2, kClient2, kVersion2); |
+ base::RunLoop().RunUntilIdle(); |
EXPECT_EQ(kClient2, auth_handler.client_); |
EXPECT_EQ(kVersion2, auth_handler.version_); |
EXPECT_EQ(kTestKey2, auth_handler.key_); |