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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler_unittest.cc

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 4 months 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: 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 b5bc70941c7f4dda9612554eab18204e8ce6c5d3..9a800b643e6c7b69f0d277ed6420911d0199d79d 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"
@@ -64,8 +65,10 @@ class TestDataReductionProxyAuthRequestHandler
TestDataReductionProxyAuthRequestHandler(
const std::string& client,
const std::string& version,
- DataReductionProxyParams* params)
- : DataReductionProxyAuthRequestHandler(client,version, params) {}
+ DataReductionProxyParams* params,
+ base::MessageLoopProxy* loop_proxy)
+ : DataReductionProxyAuthRequestHandler(
+ client, version, params, loop_proxy) {}
virtual std::string GetDefaultKey() const OVERRIDE {
return kTestKey;
@@ -86,6 +89,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) {
@@ -99,8 +109,10 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) {
~TestDataReductionProxyParams::HAS_DEV_ORIGIN));
TestDataReductionProxyAuthRequestHandler auth_handler(kClient,
kVersion,
- params.get());
+ params.get(),
+ loop_proxy_);
auth_handler.Init();
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(auth_handler.client_, kClient);
EXPECT_EQ(kVersion, auth_handler.version_);
EXPECT_EQ(auth_handler.key_, kTestKey);
@@ -108,7 +120,8 @@ TEST_F(DataReductionProxyAuthRequestHandlerTest, Authorization) {
EXPECT_EQ(kExpectedSession, auth_handler.session_);
// Now set a key.
- auth_handler.SetKey(kTestKey2);
+ auth_handler.SetKeyOnUI(kTestKey2);
+ base::RunLoop().RunUntilIdle();
EXPECT_EQ(kTestKey2, auth_handler.key_);
EXPECT_EQ(kExpectedCredentials2, auth_handler.credentials_);
EXPECT_EQ(kExpectedSession2, auth_handler.session_);

Powered by Google App Engine
This is Rietveld 408576698