| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/extension_function.h" | 10 #include "chrome/browser/extensions/extension_function.h" |
| 11 | 11 |
| 12 template <typename T> struct DefaultSingletonTraits; | 12 template <typename T> struct DefaultSingletonTraits; |
| 13 | 13 |
| 14 class ExtensionTestPassFunction : public SyncExtensionFunction { | 14 class ExtensionTestPassFunction : public SyncExtensionFunction { |
| 15 ~ExtensionTestPassFunction(); | 15 virtual ~ExtensionTestPassFunction(); |
| 16 virtual bool RunImpl(); | 16 virtual bool RunImpl(); |
| 17 DECLARE_EXTENSION_FUNCTION_NAME("test.notifyPass") | 17 DECLARE_EXTENSION_FUNCTION_NAME("test.notifyPass") |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 class ExtensionTestFailFunction : public SyncExtensionFunction { | 20 class ExtensionTestFailFunction : public SyncExtensionFunction { |
| 21 ~ExtensionTestFailFunction(); | 21 virtual ~ExtensionTestFailFunction(); |
| 22 virtual bool RunImpl(); | 22 virtual bool RunImpl(); |
| 23 DECLARE_EXTENSION_FUNCTION_NAME("test.notifyFail") | 23 DECLARE_EXTENSION_FUNCTION_NAME("test.notifyFail") |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class ExtensionTestLogFunction : public SyncExtensionFunction { | 26 class ExtensionTestLogFunction : public SyncExtensionFunction { |
| 27 ~ExtensionTestLogFunction(); | 27 virtual ~ExtensionTestLogFunction(); |
| 28 virtual bool RunImpl(); | 28 virtual bool RunImpl(); |
| 29 DECLARE_EXTENSION_FUNCTION_NAME("test.log") | 29 DECLARE_EXTENSION_FUNCTION_NAME("test.log") |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 class ExtensionTestQuotaResetFunction : public SyncExtensionFunction { | 32 class ExtensionTestQuotaResetFunction : public SyncExtensionFunction { |
| 33 ~ExtensionTestQuotaResetFunction(); | 33 virtual ~ExtensionTestQuotaResetFunction(); |
| 34 virtual bool RunImpl(); | 34 virtual bool RunImpl(); |
| 35 DECLARE_EXTENSION_FUNCTION_NAME("test.resetQuota") | 35 DECLARE_EXTENSION_FUNCTION_NAME("test.resetQuota") |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 class ExtensionTestCreateIncognitoTabFunction : public SyncExtensionFunction { | 38 class ExtensionTestCreateIncognitoTabFunction : public SyncExtensionFunction { |
| 39 ~ExtensionTestCreateIncognitoTabFunction(); | 39 virtual ~ExtensionTestCreateIncognitoTabFunction(); |
| 40 virtual bool RunImpl(); | 40 virtual bool RunImpl(); |
| 41 DECLARE_EXTENSION_FUNCTION_NAME("test.createIncognitoTab") | 41 DECLARE_EXTENSION_FUNCTION_NAME("test.createIncognitoTab") |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class ExtensionTestSendMessageFunction : public AsyncExtensionFunction { | 44 class ExtensionTestSendMessageFunction : public AsyncExtensionFunction { |
| 45 public: | 45 public: |
| 46 // Sends a reply back to the calling extension. Many extensions don't need | 46 // Sends a reply back to the calling extension. Many extensions don't need |
| 47 // a reply and will just ignore it. | 47 // a reply and will just ignore it. |
| 48 void Reply(const std::string& message); | 48 void Reply(const std::string& message); |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 ~ExtensionTestSendMessageFunction(); | 51 virtual ~ExtensionTestSendMessageFunction(); |
| 52 virtual bool RunImpl(); | 52 virtual bool RunImpl(); |
| 53 DECLARE_EXTENSION_FUNCTION_NAME("test.sendMessage") | 53 DECLARE_EXTENSION_FUNCTION_NAME("test.sendMessage") |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 class ExtensionTestGetConfigFunction : public SyncExtensionFunction { | 56 class ExtensionTestGetConfigFunction : public SyncExtensionFunction { |
| 57 public: | 57 public: |
| 58 // Set the dictionary returned by chrome.test.getConfig(). | 58 // Set the dictionary returned by chrome.test.getConfig(). |
| 59 // Does not take ownership of |value|. | 59 // Does not take ownership of |value|. |
| 60 static void set_test_config_state(DictionaryValue* value); | 60 static void set_test_config_state(DictionaryValue* value); |
| 61 | 61 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 74 const DictionaryValue* config_state() { | 74 const DictionaryValue* config_state() { |
| 75 return config_state_; | 75 return config_state_; |
| 76 } | 76 } |
| 77 private: | 77 private: |
| 78 friend struct DefaultSingletonTraits<TestConfigState>; | 78 friend struct DefaultSingletonTraits<TestConfigState>; |
| 79 TestConfigState(); | 79 TestConfigState(); |
| 80 DictionaryValue* config_state_; | 80 DictionaryValue* config_state_; |
| 81 DISALLOW_COPY_AND_ASSIGN(TestConfigState); | 81 DISALLOW_COPY_AND_ASSIGN(TestConfigState); |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 ~ExtensionTestGetConfigFunction(); | 84 virtual ~ExtensionTestGetConfigFunction(); |
| 85 virtual bool RunImpl(); | 85 virtual bool RunImpl(); |
| 86 DECLARE_EXTENSION_FUNCTION_NAME("test.getConfig") | 86 DECLARE_EXTENSION_FUNCTION_NAME("test.getConfig") |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ | 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ |
| OLD | NEW |