Commit c100957d authored by jianli@chromium.org's avatar jianli@chromium.org

Remove GCMDriver::IsGCMClientReady

This is not longer used.

R=fgorski@chromium.org
TBR=arv@chromium.org
BUG=none
TEST=tests updated

Review URL: https://codereview.chromium.org/344033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278526 0039d316-1c4b-4281-b951-d872f2087c98
parent 0bd014c5
<!DOCTYPE HTML>
<!DOCTYPE HTML>
<html i18n-values="dir:textdirection">
<head>
<meta charset="utf-8">
......@@ -64,13 +64,6 @@
<td id="gcm-client-state">
</td>
</tr>
<tr>
<td>
GCM Client Is Ready
</td>
<td id="gcm-client-ready">
</td>
</tr>
<tr>
<td>
Connection Client Created
......
......@@ -33,7 +33,6 @@ cr.define('gcmInternals', function() {
setIfExists(info, 'signedInUserName', 'signed-in-username');
setIfExists(info, 'gcmClientCreated', 'gcm-client-created');
setIfExists(info, 'gcmClientState', 'gcm-client-state');
setIfExists(info, 'gcmClientReady', 'gcm-client-ready');
setIfExists(info, 'connectionClientCreated', 'connection-client-created');
setIfExists(info, 'connectionState', 'connection-state');
setIfExists(info, 'registeredAppIds', 'registered-app-ids');
......
......@@ -157,8 +157,6 @@ void GcmInternalsUIMessageHandler::ReturnResults(
if (profile_service) {
device_info->SetString("signedInUserName",
profile_service->SignedInUserName());
device_info->SetBoolean("gcmClientReady",
profile_service->driver()->IsGCMClientReady());
}
if (stats) {
results.SetBoolean("isRecording", stats->is_recording);
......
......@@ -42,10 +42,6 @@ bool FakeGCMDriver::IsStarted() const {
return true;
}
bool FakeGCMDriver::IsGCMClientReady() const {
return true;
}
bool FakeGCMDriver::IsConnected() const {
return true;
}
......
......@@ -29,7 +29,6 @@ class FakeGCMDriver : public GCMDriver {
virtual void Disable() OVERRIDE;
virtual GCMClient* GetGCMClientForTesting() const OVERRIDE;
virtual bool IsStarted() const OVERRIDE;
virtual bool IsGCMClientReady() const OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
bool clear_logs) OVERRIDE;
......
......@@ -94,9 +94,6 @@ class GCMDriver {
// Returns true if the service was started.
virtual bool IsStarted() const = 0;
// Returns true if the gcm client is ready.
virtual bool IsGCMClientReady() const = 0;
// Returns true if the gcm client has an open and active connection.
virtual bool IsConnected() const = 0;
......
......@@ -113,10 +113,6 @@ bool GCMDriverAndroid::IsStarted() const {
return true;
}
bool GCMDriverAndroid::IsGCMClientReady() const {
return true;
}
bool GCMDriverAndroid::IsConnected() const {
// TODO(gcm): hook up to GCM connected status
return true;
......
......@@ -50,7 +50,6 @@ class GCMDriverAndroid : public GCMDriver {
virtual void Disable() OVERRIDE;
virtual GCMClient* GetGCMClientForTesting() const OVERRIDE;
virtual bool IsStarted() const OVERRIDE;
virtual bool IsGCMClientReady() const OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
bool clear_logs) OVERRIDE;
......
......@@ -356,7 +356,6 @@ GCMDriverDesktop::GCMDriverDesktop(
: signed_in_(false),
gcm_started_(false),
gcm_enabled_(true),
gcm_client_ready_(false),
connected_(false),
ui_thread_(ui_thread),
io_thread_(io_thread),
......@@ -552,11 +551,6 @@ bool GCMDriverDesktop::IsStarted() const {
return gcm_started_;
}
bool GCMDriverDesktop::IsGCMClientReady() const {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());
return gcm_client_ready_;
}
bool GCMDriverDesktop::IsConnected() const {
return connected_;
}
......@@ -626,7 +620,6 @@ void GCMDriverDesktop::RemoveCachedData() {
weak_ptr_factory_.InvalidateWeakPtrs();
gcm_started_ = false;
gcm_client_ready_ = false;
delayed_task_controller_.reset();
ClearCallbacks();
}
......@@ -668,10 +661,6 @@ void GCMDriverDesktop::MessageSendError(
void GCMDriverDesktop::GCMClientReady() {
DCHECK(ui_thread_->RunsTasksOnCurrentThread());
if (gcm_client_ready_)
return;
gcm_client_ready_ = true;
delayed_task_controller_->SetReady();
}
......
......@@ -61,7 +61,6 @@ class GCMDriverDesktop : public GCMDriver {
virtual void Disable() OVERRIDE;
virtual GCMClient* GetGCMClientForTesting() const OVERRIDE;
virtual bool IsStarted() const OVERRIDE;
virtual bool IsGCMClientReady() const OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
virtual void GetGCMStatistics(const GetGCMStatisticsCallback& callback,
bool clear_logs) OVERRIDE;
......@@ -118,9 +117,6 @@ class GCMDriverDesktop : public GCMDriver {
// Flag to indicate if GCM is enabled.
bool gcm_enabled_;
// Flag to indicate if GCMClient is ready.
bool gcm_client_ready_;
// Flag to indicate the last known state of the GCM client. Because this
// flag lives on the UI thread, while the GCM client lives on the IO thread,
// it may be out of date while connection changes are happening.
......
......@@ -326,12 +326,10 @@ TEST_F(GCMDriverTest, SignInAndSignOutOnGCMEnabled) {
// GCMClient should be started after sign-in.
SignIn(kTestAccountID1);
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// GCMClient should be checked out after sign-out.
SignOut();
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::CHECKED_OUT, GetGCMClient()->status());
}
......@@ -345,12 +343,10 @@ TEST_F(GCMDriverTest, SignInAndSignOutOnGCMDisabled) {
// GCMClient should not be started after sign-in.
SignIn(kTestAccountID1);
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::UNINITIALIZED, GetGCMClient()->status());
// Check-out should still be performed after sign-out.
SignOut();
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::CHECKED_OUT, GetGCMClient()->status());
}
......@@ -360,19 +356,16 @@ TEST_F(GCMDriverTest, SignOutAndThenSignIn) {
// GCMClient should be started after sign-in.
SignIn(kTestAccountID1);
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// GCMClient should be checked out after sign-out.
SignOut();
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::CHECKED_OUT, GetGCMClient()->status());
// Sign-in with a different account.
SignIn(kTestAccountID2);
// GCMClient should be started again.
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
}
......@@ -382,7 +375,6 @@ TEST_F(GCMDriverTest, DisableAndReenableGCM) {
SignIn(kTestAccountID1);
// GCMClient should be started.
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// Disables the GCM.
......@@ -391,7 +383,6 @@ TEST_F(GCMDriverTest, DisableAndReenableGCM) {
PumpUILoop();
// GCMClient should be stopped.
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STOPPED, GetGCMClient()->status());
// Enables the GCM.
......@@ -400,7 +391,6 @@ TEST_F(GCMDriverTest, DisableAndReenableGCM) {
PumpUILoop();
// GCMClient should be started.
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// Disables the GCM.
......@@ -409,14 +399,12 @@ TEST_F(GCMDriverTest, DisableAndReenableGCM) {
PumpUILoop();
// GCMClient should be stopped.
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STOPPED, GetGCMClient()->status());
// Sign out.
SignOut();
// GCMClient should be checked out.
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::CHECKED_OUT, GetGCMClient()->status());
}
......@@ -425,42 +413,36 @@ TEST_F(GCMDriverTest, StartOrStopGCMOnDemand) {
SignIn(kTestAccountID1);
// GCMClient is not started.
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::UNINITIALIZED, GetGCMClient()->status());
// GCMClient is started after an app handler has been added.
driver()->AddAppHandler(kTestAppID1, gcm_app_handler());
PumpIOLoop();
PumpUILoop();
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// Add another app handler.
driver()->AddAppHandler(kTestAppID2, gcm_app_handler());
PumpIOLoop();
PumpUILoop();
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// GCMClient remains active after one app handler is gone.
driver()->RemoveAppHandler(kTestAppID1);
PumpIOLoop();
PumpUILoop();
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
// GCMClient should be stopped after the last app handler is gone.
driver()->RemoveAppHandler(kTestAppID2);
PumpIOLoop();
PumpUILoop();
EXPECT_FALSE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STOPPED, GetGCMClient()->status());
// GCMClient is restarted after an app handler has been added.
driver()->AddAppHandler(kTestAppID2, gcm_app_handler());
PumpIOLoop();
PumpUILoop();
EXPECT_TRUE(driver()->IsGCMClientReady());
EXPECT_EQ(FakeGCMClient::STARTED, GetGCMClient()->status());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment