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

Side by Side Diff: chrome/browser/chromeos/policy/consumer_management_notifier_factory_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/policy/consumer_management_notifier_factory.h" 5 #include "chrome/browser/chromeos/policy/consumer_management_notifier_factory.h"
6 6
7 #include "chrome/browser/browser_process.h" 7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/browser_process_platform_part.h" 8 #include "chrome/browser/browser_process_platform_part.h"
9 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 9 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 10 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 11 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
12 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 12 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
13 #include "chrome/browser/chromeos/policy/consumer_management_stage.h" 13 #include "chrome/browser/chromeos/policy/consumer_management_stage.h"
14 #include "chrome/browser/chromeos/policy/fake_consumer_management_service.h" 14 #include "chrome/browser/chromeos/policy/fake_consumer_management_service.h"
15 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
16 #include "chrome/test/base/testing_profile_manager.h" 16 #include "chrome/test/base/testing_profile_manager.h"
17 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace { 20 namespace {
20 const char* kTestOwner = "test.owner@chromium.org.test"; 21 const char* kTestOwner = "test.owner@chromium.org.test";
21 const char* kTestUser = "test.user@chromium.org.test"; 22 const char* kTestUser = "test.user@chromium.org.test";
22 } 23 }
23 24
24 namespace policy { 25 namespace policy {
25 26
26 class ConsumerManagementNotifierFactoryTest : public testing::Test { 27 class ConsumerManagementNotifierFactoryTest : public testing::Test {
(...skipping 18 matching lines...) Expand all
45 // Set up FakeChromeUserManager. 46 // Set up FakeChromeUserManager.
46 fake_user_manager_->AddUser(kTestOwner); 47 fake_user_manager_->AddUser(kTestOwner);
47 fake_user_manager_->AddUser(kTestUser); 48 fake_user_manager_->AddUser(kTestUser);
48 fake_user_manager_->set_owner_email(kTestOwner); 49 fake_user_manager_->set_owner_email(kTestOwner);
49 } 50 }
50 51
51 void SetUp() override { 52 void SetUp() override {
52 ASSERT_TRUE(testing_profile_manager_->SetUp()); 53 ASSERT_TRUE(testing_profile_manager_->SetUp());
53 } 54 }
54 55
56 content::TestBrowserThreadBundle thread_bundle_;
55 FakeConsumerManagementService* fake_service_; 57 FakeConsumerManagementService* fake_service_;
56 chromeos::FakeChromeUserManager* fake_user_manager_; 58 chromeos::FakeChromeUserManager* fake_user_manager_;
57 chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_; 59 chromeos::ScopedUserManagerEnabler scoped_user_manager_enabler_;
58 scoped_ptr<TestingProfileManager> testing_profile_manager_; 60 scoped_ptr<TestingProfileManager> testing_profile_manager_;
59 }; 61 };
60 62
61 TEST_F(ConsumerManagementNotifierFactoryTest, ServiceIsCreated) { 63 TEST_F(ConsumerManagementNotifierFactoryTest, ServiceIsCreated) {
62 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner); 64 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestOwner);
63 EXPECT_TRUE( 65 EXPECT_TRUE(
64 ConsumerManagementNotifierFactory::GetForBrowserContext(profile)); 66 ConsumerManagementNotifierFactory::GetForBrowserContext(profile));
65 } 67 }
66 68
67 TEST_F(ConsumerManagementNotifierFactoryTest, 69 TEST_F(ConsumerManagementNotifierFactoryTest,
68 ServiceIsNotCreatedForNonOwner) { 70 ServiceIsNotCreatedForNonOwner) {
69 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestUser); 71 Profile* profile = testing_profile_manager_->CreateTestingProfile(kTestUser);
70 EXPECT_FALSE( 72 EXPECT_FALSE(
71 ConsumerManagementNotifierFactory::GetForBrowserContext(profile)); 73 ConsumerManagementNotifierFactory::GetForBrowserContext(profile));
72 } 74 }
73 75
74 } // namespace policy 76 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698