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

Unified Diff: components/gcm_driver/gcm_driver_desktop_unittest.cc

Issue 330733002: Move IdentityProvider usage from GCMDriverDesktop to GCMProfileService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 6 years, 6 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/gcm_driver/gcm_driver_desktop_unittest.cc
diff --git a/components/gcm_driver/gcm_driver_desktop_unittest.cc b/components/gcm_driver/gcm_driver_desktop_unittest.cc
index d4694cfb520c2c47ad30818f62e53c15a4ab6818..847ffdea9ca8f9fa985a88364d12ebc9397f2a0f 100644
--- a/components/gcm_driver/gcm_driver_desktop_unittest.cc
+++ b/components/gcm_driver/gcm_driver_desktop_unittest.cc
@@ -19,8 +19,6 @@
#include "components/gcm_driver/fake_gcm_client_factory.h"
#include "components/gcm_driver/gcm_app_handler.h"
#include "components/gcm_driver/gcm_client_factory.h"
-#include "google_apis/gaia/fake_identity_provider.h"
-#include "google_apis/gaia/fake_oauth2_token_service.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -109,9 +107,6 @@ class GCMDriverTest : public testing::Test {
void UnregisterCompleted(GCMClient::Result result);
base::ScopedTempDir temp_dir_;
- FakeOAuth2TokenService token_service_;
- scoped_ptr<FakeIdentityProvider> identity_provider_owner_;
- FakeIdentityProvider* identity_provider_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
base::MessageLoopForUI message_loop_;
base::Thread io_thread_;
@@ -130,14 +125,11 @@ class GCMDriverTest : public testing::Test {
};
GCMDriverTest::GCMDriverTest()
- : identity_provider_(NULL),
- task_runner_(new base::TestSimpleTaskRunner()),
+ : task_runner_(new base::TestSimpleTaskRunner()),
io_thread_("IOThread"),
registration_result_(GCMClient::UNKNOWN_ERROR),
send_result_(GCMClient::UNKNOWN_ERROR),
unregistration_result_(GCMClient::UNKNOWN_ERROR) {
- identity_provider_owner_.reset(new FakeIdentityProvider(&token_service_));
- identity_provider_ = identity_provider_owner_.get();
}
GCMDriverTest::~GCMDriverTest() {
@@ -196,7 +188,6 @@ void GCMDriverTest::CreateDriver(
gcm_client_start_mode,
base::MessageLoopProxy::current(),
io_thread_.message_loop_proxy())).Pass(),
- identity_provider_owner_.PassAs<IdentityProvider>(),
GCMClient::ChromeBuildInfo(),
temp_dir_.path(),
request_context,
@@ -218,14 +209,17 @@ void GCMDriverTest::RemoveAppHandlers() {
}
void GCMDriverTest::SignIn(const std::string& account_id) {
- token_service_.AddAccount(account_id);
- identity_provider_->LogIn(account_id);
+ if (!driver_)
bartfab (slow) 2014/06/13 11:27:21 Nit: Why is this necessary? I do not see a single
jianli 2014/06/13 18:04:49 You're right. It is not needed. Previously I added
+ return;
+ driver_->SignIn();
PumpIOLoop();
PumpUILoop();
}
void GCMDriverTest::SignOut() {
- identity_provider_->LogOut();
+ if (!driver_)
+ return;
+ driver_->Purge();
PumpIOLoop();
PumpUILoop();
}
@@ -297,7 +291,7 @@ void GCMDriverTest::UnregisterCompleted(GCMClient::Result result) {
async_operation_completed_callback_.Run();
}
-TEST_F(GCMDriverTest, CreateGCMDriverBeforeSignIn) {
+TEST_F(GCMDriverTest, Create) {
// Create GCMDriver first. GCM is not started.
CreateDriver(FakeGCMClient::NO_DELAY_START);
EXPECT_FALSE(driver()->IsStarted());
@@ -311,19 +305,6 @@ TEST_F(GCMDriverTest, CreateGCMDriverBeforeSignIn) {
EXPECT_TRUE(driver()->IsStarted());
}
-TEST_F(GCMDriverTest, CreateGCMDriverAfterSignIn) {
- // Sign in. Nothings happens since GCMDriver is not created.
- SignIn(kTestAccountID1);
-
- // Create GCMDriver after sign-in. GCM is not started.
- CreateDriver(FakeGCMClient::NO_DELAY_START);
- EXPECT_FALSE(driver()->IsStarted());
-
- // GCM will be started only after both sign-in and app handler being
- AddAppHandlers();
- EXPECT_TRUE(driver()->IsStarted());
-}
-
TEST_F(GCMDriverTest, Shutdown) {
CreateDriver(FakeGCMClient::NO_DELAY_START);
EXPECT_FALSE(HasAppHandlers());

Powered by Google App Engine
This is Rietveld 408576698