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

Unified Diff: blimp/client/core/session/identity_source_unittest.cc

Issue 2406403003: Clean up Assignment Create in BlimpClientContextImpl. (Closed)
Patch Set: Addresses dtrainor's #14 comments. Created 4 years, 2 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
« no previous file with comments | « blimp/client/core/session/identity_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/session/identity_source_unittest.cc
diff --git a/blimp/client/core/session/identity_source_unittest.cc b/blimp/client/core/session/identity_source_unittest.cc
index 463a2fa2994003453e66ae4dec217865b690dde9..61d9b1b2fdde0004326b735020be7e7c9ca97ca2 100644
--- a/blimp/client/core/session/identity_source_unittest.cc
+++ b/blimp/client/core/session/identity_source_unittest.cc
@@ -6,6 +6,7 @@
#include <memory>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@@ -23,9 +24,11 @@ namespace {
class MockIdentitySource : public IdentitySource {
public:
- explicit MockIdentitySource(BlimpClientContextDelegate* delegate,
- const IdentitySource::TokenCallback& callback)
- : IdentitySource(delegate, callback),
+ MockIdentitySource(
+ std::unique_ptr<IdentityProvider> identity_provider,
+ base::Callback<void(const GoogleServiceAuthError&)> error_callback,
+ const IdentitySource::TokenCallback& callback)
+ : IdentitySource(std::move(identity_provider), error_callback, callback),
success_(0),
fail_(0),
refresh_(0),
@@ -101,7 +104,9 @@ class IdentitySourceTest : public testing::Test {
TEST_F(IdentitySourceTest, TestConnect) {
TestBlimpClientContextDelegate mock_blimp_delegate;
MockIdentitySource auth(
- &mock_blimp_delegate,
+ mock_blimp_delegate.CreateIdentityProvider(),
+ base::Bind(&TestBlimpClientContextDelegate::OnAuthenticationError,
+ base::Unretained(&mock_blimp_delegate)),
base::Bind(&MockIdentitySource::MockTokenCall, base::Unretained(&auth)));
FakeIdentityProvider* id_provider =
static_cast<FakeIdentityProvider*>(auth.GetIdentityProvider());
@@ -187,7 +192,9 @@ TEST_F(IdentitySourceTest, TestConnect) {
TEST_F(IdentitySourceTest, TestConnectRetry) {
TestBlimpClientContextDelegate mock_blimp_delegate;
MockIdentitySource auth(
- &mock_blimp_delegate,
+ mock_blimp_delegate.CreateIdentityProvider(),
+ base::Bind(&TestBlimpClientContextDelegate::OnAuthenticationError,
+ base::Unretained(&mock_blimp_delegate)),
base::Bind(&MockIdentitySource::MockTokenCall, base::Unretained(&auth)));
FakeOAuth2TokenService* token_service = mock_blimp_delegate.GetTokenService();
FakeIdentityProvider* id_provider =
@@ -227,7 +234,9 @@ TEST_F(IdentitySourceTest, TestConnectRetry) {
TEST_F(IdentitySourceTest, TestConnectFailDelegateCallback) {
TestBlimpClientContextDelegate mock_blimp_delegate;
MockIdentitySource auth(
- &mock_blimp_delegate,
+ mock_blimp_delegate.CreateIdentityProvider(),
+ base::Bind(&TestBlimpClientContextDelegate::OnAuthenticationError,
+ base::Unretained(&mock_blimp_delegate)),
base::Bind(&MockIdentitySource::MockTokenCall, base::Unretained(&auth)));
FakeOAuth2TokenService* token_service = mock_blimp_delegate.GetTokenService();
FakeIdentityProvider* id_provider =
« no previous file with comments | « blimp/client/core/session/identity_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698