1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "base/basictypes.h" 6 #include "base/memory/scoped_ptr.h" 7 #include "chrome/browser/chromeos/login/enterprise_enrollment_screen.h" 8 #include "chrome/browser/chromeos/login/mock_screen_observer.h" 9 #include "chrome/browser/chromeos/login/wizard_controller.h" 10 #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" 11 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gtest/include/gtest/gtest.h" 13 14 using testing::Mock; 15 16 namespace chromeos { 17 18 class EnterpriseEnrollmentScreenTest : public WizardInProcessBrowserTest { 19 public: 20 EnterpriseEnrollmentScreenTest() 21 : WizardInProcessBrowserTest( 22 WizardController::kEnterpriseEnrollmentScreenName) {} 23 24 private: 25 DISALLOW_COPY_AND_ASSIGN(EnterpriseEnrollmentScreenTest); 26 }; 27 28 IN_PROC_BROWSER_TEST_F(EnterpriseEnrollmentScreenTest, TestCancel) { 29 ASSERT_TRUE(controller() != NULL); 30 MockScreenObserver mock_screen_observer; 31 controller()->set_observer(&mock_screen_observer); 32 EnterpriseEnrollmentScreen* enterprise_enrollment_screen = 33 controller()->GetEnterpriseEnrollmentScreen(); 34 ASSERT_TRUE(enterprise_enrollment_screen != NULL); 35 ASSERT_EQ(controller()->current_screen(), enterprise_enrollment_screen); 36 37 EXPECT_CALL(mock_screen_observer, 38 OnExit(ScreenObserver::ENTERPRISE_ENROLLMENT_CANCELLED)); 39 enterprise_enrollment_screen->CancelEnrollment(); 40 Mock::VerifyAndClearExpectations(&mock_screen_observer); 41 42 controller()->set_observer(NULL); 43 } 44 45 } // namespace chromeos 46