1 // Copyright (c) 2012 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_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 7 8 #include <string> 9 10 #include "base/compiler_specific.h" 11 #include "chrome/browser/extensions/extension_function.h" 12 #include "components/browser_context_keyed_service/browser_context_keyed_service.h" 13 14 namespace extensions { 15 16 class AutotestPrivateLogoutFunction : public SyncExtensionFunction { 17 public: 18 DECLARE_EXTENSION_FUNCTION("autotestPrivate.logout", AUTOTESTPRIVATE_LOGOUT) 19 20 private: 21 virtual ~AutotestPrivateLogoutFunction() {} 22 virtual bool RunImpl() OVERRIDE; 23 }; 24 25 class AutotestPrivateRestartFunction: public SyncExtensionFunction { 26 public: 27 DECLARE_EXTENSION_FUNCTION("autotestPrivate.restart", AUTOTESTPRIVATE_RESTART) 28 29 private: 30 virtual ~AutotestPrivateRestartFunction() {} 31 virtual bool RunImpl() OVERRIDE; 32 }; 33 34 class AutotestPrivateShutdownFunction: public SyncExtensionFunction { 35 public: 36 DECLARE_EXTENSION_FUNCTION("autotestPrivate.shutdown", 37 AUTOTESTPRIVATE_SHUTDOWN) 38 39 private: 40 virtual ~AutotestPrivateShutdownFunction() {} 41 virtual bool RunImpl() OVERRIDE; 42 }; 43 44 class AutotestPrivateLoginStatusFunction: public SyncExtensionFunction { 45 public: 46 DECLARE_EXTENSION_FUNCTION("autotestPrivate.loginStatus", 47 AUTOTESTPRIVATE_LOGINSTATUS) 48 49 private: 50 virtual ~AutotestPrivateLoginStatusFunction() {} 51 virtual bool RunImpl() OVERRIDE; 52 }; 53 54 // Don't kill the browser when we're in a browser test. 55 void SetAutotestPrivateTest(); 56 57 // The profile-keyed service that manages the autotestPrivate extension API. 58 class AutotestPrivateAPI : public BrowserContextKeyedService { 59 public: 60 AutotestPrivateAPI(); 61 62 // TODO(achuith): Replace these with a mock object for system calls. 63 bool test_mode() const { return test_mode_; } 64 void set_test_mode(bool test_mode) { test_mode_ = test_mode; } 65 66 private: 67 virtual ~AutotestPrivateAPI(); 68 69 bool test_mode_; // true for ExtensionApiTest.AutotestPrivate browser test. 70 }; 71 72 } // namespace extensions 73 74 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOTEST_PRIVATE_AUTOTEST_PRIVATE_API_H_ 75