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

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

Issue 733613005: Move the notification part out of ConsumerEnrollmentHandler so that it can be reused for unenrollme… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enroll
Patch Set: Created 6 years, 1 month 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/consumer_management_notification_factory_unittest.cc
diff --git a/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc b/chrome/browser/chromeos/policy/consumer_management_notification_factory_unittest.cc
similarity index 66%
copy from chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc
copy to chrome/browser/chromeos/policy/consumer_management_notification_factory_unittest.cc
index 24bb84678a0a9c94ea9ee1a940a29e4c36d4b6ff..06f6a3e5625077871c6cecbdb4614887bc2e881b 100644
--- a/chrome/browser/chromeos/policy/consumer_enrollment_handler_factory_unittest.cc
+++ b/chrome/browser/chromeos/policy/consumer_management_notification_factory_unittest.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/chromeos/policy/consumer_enrollment_handler_factory.h"
+#include "chrome/browser/chromeos/policy/consumer_management_notification_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/chromeos/login/users/fake_user_manager.h"
#include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
+#include "chrome/browser/chromeos/policy/consumer_management_notification.h"
#include "chrome/browser/chromeos/policy/consumer_management_service.h"
#include "chrome/browser/chromeos/policy/fake_consumer_management_service.h"
#include "chrome/test/base/testing_browser_process.h"
@@ -22,18 +23,18 @@ const char* kTestUser = "test.user@chromium.org.test";
namespace policy {
-class ConsumerEnrollmentHandlerFactoryTest : public testing::Test {
+class ConsumerManagementNotificationFactoryTest : public testing::Test {
public:
- ConsumerEnrollmentHandlerFactoryTest()
+ ConsumerManagementNotificationFactoryTest()
: fake_service_(new FakeConsumerManagementService()),
fake_user_manager_(new chromeos::FakeUserManager()),
scoped_user_manager_enabler_(fake_user_manager_),
testing_profile_manager_(new TestingProfileManager(
TestingBrowserProcess::GetGlobal())) {
// Set up FakeConsumerManagementService.
- fake_service_->set_status(ConsumerManagementService::STATUS_ENROLLING);
- fake_service_->SetEnrollmentStage(
- ConsumerManagementService::ENROLLMENT_STAGE_OWNER_STORED);
+ fake_service_->SetStatusAndEnrollmentStage(
+ ConsumerManagementService::STATUS_UNENROLLED,
+ ConsumerManagementService::ENROLLMENT_STAGE_NONE);
// Inject fake objects.
BrowserPolicyConnectorChromeOS* connector =
@@ -57,24 +58,17 @@ class ConsumerEnrollmentHandlerFactoryTest : public testing::Test {
scoped_ptr<TestingProfileManager> testing_profile_manager_;
};
-TEST_F(ConsumerEnrollmentHandlerFactoryTest, ServiceIsCreated) {
+TEST_F(ConsumerManagementNotificationFactoryTest, ServiceIsCreated) {
Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner);
- EXPECT_TRUE(ConsumerEnrollmentHandlerFactory::GetForBrowserContext(profile));
+ EXPECT_TRUE(
+ ConsumerManagementNotificationFactory::GetForBrowserContext(profile));
}
-TEST_F(ConsumerEnrollmentHandlerFactoryTest, ServiceIsNotCreatedForNonOwner) {
+TEST_F(ConsumerManagementNotificationFactoryTest,
+ ServiceIsNotCreatedForNonOwner) {
Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestUser);
- EXPECT_FALSE(ConsumerEnrollmentHandlerFactory::GetForBrowserContext(profile));
-}
-
-TEST_F(ConsumerEnrollmentHandlerFactoryTest,
- ServiceIsNotCreatedIfItHasNothingToDo) {
- fake_service_->set_status(ConsumerManagementService::STATUS_UNENROLLED);
- fake_service_->SetEnrollmentStage(
- ConsumerManagementService::ENROLLMENT_STAGE_NONE);
-
- Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner);
- EXPECT_FALSE(ConsumerEnrollmentHandlerFactory::GetForBrowserContext(profile));
+ EXPECT_FALSE(
+ ConsumerManagementNotificationFactory::GetForBrowserContext(profile));
}
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698