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

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: Fix after sync 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
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | google_apis/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2fb08ba2b4eaed600caf595e21cba5d4e6be497f..26e1573d584128157c912f1e597d9eded093952f 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,13 @@ void GCMDriverTest::RemoveAppHandlers() {
}
void GCMDriverTest::SignIn(const std::string& account_id) {
- token_service_.AddAccount(account_id);
- identity_provider_->LogIn(account_id);
+ driver_->OnSignedIn();
PumpIOLoop();
PumpUILoop();
}
void GCMDriverTest::SignOut() {
- identity_provider_->LogOut();
+ driver_->Purge();
PumpIOLoop();
PumpUILoop();
}
@@ -297,7 +287,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());
@@ -316,24 +306,6 @@ TEST_F(GCMDriverTest, CreateGCMDriverBeforeSignIn) {
EXPECT_TRUE(gcm_app_handler()->connected());
}
-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());
- EXPECT_FALSE(driver()->IsConnected());
- EXPECT_FALSE(gcm_app_handler()->connected());
-
- // GCM will be started only after both sign-in and app handler being added.
- AddAppHandlers();
- EXPECT_TRUE(driver()->IsStarted());
- PumpIOLoop();
- EXPECT_TRUE(driver()->IsConnected());
- EXPECT_TRUE(gcm_app_handler()->connected());
-}
-
TEST_F(GCMDriverTest, Shutdown) {
CreateDriver(FakeGCMClient::NO_DELAY_START);
EXPECT_FALSE(HasAppHandlers());
« no previous file with comments | « components/gcm_driver/gcm_driver_desktop.cc ('k') | google_apis/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698