oobe_base_test.h revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ 6#define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ 7 8#include <string> 9 10#include "base/callback.h" 11#include "base/command_line.h" 12#include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 13#include "chrome/browser/chromeos/login/ui/webui_login_display.h" 14#include "chrome/browser/extensions/extension_apitest.h" 15#include "chrome/test/base/in_process_browser_test.h" 16#include "content/public/test/test_utils.h" 17#include "google_apis/gaia/fake_gaia.h" 18#include "net/test/embedded_test_server/embedded_test_server.h" 19 20namespace content { 21class WebUI; 22} // namespace content 23 24namespace chromeos { 25 26class FakeUserManager; 27class NetworkPortalDetectorTestImpl; 28class SigninScreenHandler; 29 30// Base class for OOBE and Kiosk tests. 31class OobeBaseTest : public ExtensionApiTest { 32 public: 33 OobeBaseTest(); 34 virtual ~OobeBaseTest(); 35 36 protected: 37 // InProcessBrowserTest overrides. 38 virtual void SetUp() OVERRIDE; 39 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 40 virtual void SetUpOnMainThread() OVERRIDE; 41 virtual void CleanUpOnMainThread() OVERRIDE; 42 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE; 43 44 // Network status control functions. 45 void SimulateNetworkOffline(); 46 void SimulateNetworkOnline(); 47 void SimulateNetworkPortal(); 48 49 base::Closure SimulateNetworkOfflineClosure(); 50 base::Closure SimulateNetworkOnlineClosure(); 51 base::Closure SimulateNetworkPortalClosure(); 52 53 // Checks JavaScript |expression| in login screen. 54 void JsExpect(const std::string& expression); 55 56 // Returns chrome://oobe WebUI. 57 content::WebUI* GetLoginUI(); 58 59 // Returns SigninScreenHandler for login screen. 60 SigninScreenHandler* GetSigninScreenHandler(); 61 62 // Returns login display. 63 WebUILoginDisplay* GetLoginDisplay(); 64 65 scoped_ptr<FakeGaia> fake_gaia_; 66 NetworkPortalDetectorTestImpl* network_portal_detector_; 67 68 // Whether to use background networking. Note this is only effective when it 69 // is set before SetUpCommandLine is invoked. 70 bool needs_background_networking_; 71}; 72 73} // namespace chromeos 74 75#endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_OOBE_BASE_TEST_H_ 76