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