| Index: chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
|
| diff --git a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
|
| index 1cd02863acac958e40e246725b491e3a1793398a..09f927b49c73442ae7fc0a886eb0b1a7816d0194 100644
|
| --- a/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
|
| +++ b/chrome/browser/notifications/login_state_notification_blocker_chromeos_browsertest.cc
|
| @@ -5,11 +5,12 @@
|
| #include "ash/shell.h"
|
| #include "ash/system/system_notifier.h"
|
| #include "base/command_line.h"
|
| -#include "chrome/browser/chromeos/login/login_manager_test.h"
|
| +#include "chrome/browser/chromeos/login/login_manager_test_helper.h"
|
| #include "chrome/browser/chromeos/login/startup_utils.h"
|
| #include "chrome/browser/chromeos/login/user_adding_screen.h"
|
| #include "chrome/browser/notifications/login_state_notification_blocker_chromeos.h"
|
| #include "chrome/common/chrome_switches.h"
|
| +#include "chrome/test/base/in_process_browser_test.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "ui/message_center/message_center.h"
|
|
|
| @@ -23,17 +24,20 @@ const char* kTestUsers[] = {"test-user@gmail.com",
|
| } // anonymous namespace
|
|
|
| class LoginStateNotificationBlockerChromeOSBrowserTest
|
| - : public chromeos::LoginManagerTest,
|
| + : public InProcessBrowserTest,
|
| public message_center::NotificationBlocker::Observer {
|
| public:
|
| LoginStateNotificationBlockerChromeOSBrowserTest()
|
| - : chromeos::LoginManagerTest(false),
|
| - state_changed_count_(0) {}
|
| + : login_manager_test_helper_(new chromeos::LoginManagerTestHelper(false)),
|
| + state_changed_count_(0) {
|
| + set_exit_when_last_browser_closes(false);
|
| + }
|
| +
|
| virtual ~LoginStateNotificationBlockerChromeOSBrowserTest() {}
|
|
|
| // InProcessBrowserTest overrides:
|
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| - LoginManagerTest::SetUpCommandLine(command_line);
|
| + login_manager_test_helper_->SetUpCommandLine(command_line);
|
| command_line->AppendSwitch(::switches::kMultiProfiles);
|
| }
|
|
|
| @@ -41,11 +45,15 @@ class LoginStateNotificationBlockerChromeOSBrowserTest
|
| chromeos::LoginState::Get()->set_always_logged_in(false);
|
| }
|
|
|
| + virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
|
| + login_manager_test_helper_->SetUpLoginUtils();
|
| + }
|
| +
|
| virtual void CleanUpOnMainThread() OVERRIDE {
|
| if (blocker_)
|
| blocker_->RemoveObserver(this);
|
| blocker_.reset();
|
| - chromeos::LoginManagerTest::CleanUpOnMainThread();
|
| + login_manager_test_helper_->CleanUp();
|
| }
|
|
|
| protected:
|
| @@ -72,6 +80,9 @@ class LoginStateNotificationBlockerChromeOSBrowserTest
|
| return blocker_->ShouldShowNotificationAsPopup(notifier_id);
|
| }
|
|
|
| + protected:
|
| + scoped_ptr<chromeos::LoginManagerTestHelper> login_manager_test_helper_;
|
| +
|
| private:
|
| int state_changed_count_;
|
| scoped_ptr<message_center::NotificationBlocker> blocker_;
|
| @@ -81,8 +92,8 @@ class LoginStateNotificationBlockerChromeOSBrowserTest
|
|
|
| IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest,
|
| PRE_BaseTest) {
|
| - RegisterUser(kTestUsers[0]);
|
| - RegisterUser(kTestUsers[1]);
|
| + login_manager_test_helper_->RegisterUser(kTestUsers[0]);
|
| + login_manager_test_helper_->RegisterUser(kTestUsers[1]);
|
| chromeos::StartupUtils::MarkOobeCompleted();
|
| }
|
|
|
| @@ -93,8 +104,9 @@ IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest,
|
| message_center::NotifierId::APPLICATION, "test-notifier");
|
|
|
| // Logged in as a normal user.
|
| - EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1);
|
| - LoginUser(kTestUsers[0]);
|
| + EXPECT_CALL(login_manager_test_helper_->login_utils(),
|
| + DoBrowserLaunch(_, _)).Times(1);
|
| + login_manager_test_helper_->LogInUser(kTestUsers[0]);
|
| EXPECT_EQ(1, GetStateChangedCountAndReset());
|
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
|
|
|
| @@ -113,8 +125,8 @@ IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest,
|
|
|
| IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest,
|
| PRE_AlwaysAllowedNotifier) {
|
| - RegisterUser(kTestUsers[0]);
|
| - RegisterUser(kTestUsers[1]);
|
| + login_manager_test_helper_->RegisterUser(kTestUsers[0]);
|
| + login_manager_test_helper_->RegisterUser(kTestUsers[1]);
|
| chromeos::StartupUtils::MarkOobeCompleted();
|
| }
|
|
|
| @@ -128,8 +140,9 @@ IN_PROC_BROWSER_TEST_F(LoginStateNotificationBlockerChromeOSBrowserTest,
|
| ash::system_notifier::kNotifierDisplay);
|
|
|
| // Logged in as a normal user.
|
| - EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(1);
|
| - LoginUser(kTestUsers[0]);
|
| + EXPECT_CALL(login_manager_test_helper_->login_utils(),
|
| + DoBrowserLaunch(_, _)).Times(1);
|
| + login_manager_test_helper_->LogInUser(kTestUsers[0]);
|
| EXPECT_EQ(1, GetStateChangedCountAndReset());
|
| EXPECT_TRUE(ShouldShowNotificationAsPopup(notifier_id));
|
|
|
|
|