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

Unified Diff: chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc

Issue 1276853003: Revert of Send GCM id to DMServer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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: chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc
diff --git a/chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc b/chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc
index 868c4cfed375024b9a6039ee4c0cc07c7428a858..6b409f3537de804df957bdae2f23d46fe9462efa 100644
--- a/chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc
+++ b/chrome/browser/chromeos/policy/heartbeat_scheduler_unittest.cc
@@ -9,8 +9,6 @@
#include "chrome/browser/chromeos/settings/scoped_cros_settings_test_helper.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/gcm_driver/fake_gcm_driver.h"
-#include "components/policy/core/common/cloud/cloud_policy_client.h"
-#include "components/policy/core/common/cloud/mock_cloud_policy_client.h"
#include "content/public/test/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,8 +20,6 @@
const char* const kFakeEnrollmentDomain = "example.com";
const char* const kFakeDeviceId = "fake_device_id";
const char* const kHeartbeatGCMAppID = "com.google.chromeos.monitoring";
-const char* const kRegistrationId = "registration_id";
-const char* const kDMToken = "fake_dm_token";
class MockGCMDriver : public testing::StrictMock<gcm::FakeGCMDriver> {
public:
@@ -44,7 +40,7 @@
// Register().
void CompleteRegistration(const std::string& app_id,
gcm::GCMClient::Result result) {
- RegisterFinished(app_id, kRegistrationId, result);
+ RegisterFinished(app_id, "registration_id", result);
}
// Helper function to complete a send operation previously started by
@@ -60,11 +56,9 @@
public:
HeartbeatSchedulerTest()
: task_runner_(new base::TestSimpleTaskRunner()),
- scheduler_(&gcm_driver_,
- &cloud_policy_client_,
- kFakeEnrollmentDomain,
- kFakeDeviceId,
- task_runner_) {}
+ scheduler_(
+ &gcm_driver_, kFakeEnrollmentDomain, kFakeDeviceId, task_runner_) {
+ }
void SetUp() override {
settings_helper_.ReplaceProvider(chromeos::kHeartbeatEnabled);
@@ -99,7 +93,6 @@
base::MessageLoop loop_;
MockGCMDriver gcm_driver_;
chromeos::ScopedCrosSettingsTestHelper settings_helper_;
- testing::NiceMock<policy::MockCloudPolicyClient> cloud_policy_client_;
// TaskRunner used to run individual tests.
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
@@ -229,25 +222,4 @@
EXPECT_EQ(kFakeDeviceId, message.data["device_id"]);
}
-TEST_F(HeartbeatSchedulerTest, SendGcmIdUpdate) {
- // Verifies that GCM id update request was sent after GCM registration.
- cloud_policy_client_.SetDMToken(kDMToken);
- policy::CloudPolicyClient::StatusCallback callback;
- EXPECT_CALL(cloud_policy_client_, UpdateGcmId(kRegistrationId, _))
- .WillOnce(SaveArg<1>(&callback));
-
- // Enable heartbeats.
- EXPECT_CALL(gcm_driver_, RegisterImpl(kHeartbeatGCMAppID, _));
- EXPECT_CALL(gcm_driver_, SendImpl(kHeartbeatGCMAppID, _, _));
- settings_helper_.SetBoolean(chromeos::kHeartbeatEnabled, true);
- gcm_driver_.CompleteRegistration(kHeartbeatGCMAppID, gcm::GCMClient::SUCCESS);
- task_runner_->RunPendingTasks();
-
- // Verifies that CloudPolicyClient got the update request, with a valid
- // callback.
- testing::Mock::VerifyAndClearExpectations(&cloud_policy_client_);
- EXPECT_FALSE(callback.is_null());
- callback.Run(true);
-}
-
} // namespace
« no previous file with comments | « chrome/browser/chromeos/policy/heartbeat_scheduler.cc ('k') | components/policy/core/common/cloud/cloud_policy_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698