| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ | 6 #define EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ |
| 7 | 7 |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "extensions/browser/extension_function.h" | 9 #include "extensions/browser/extension_function.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class TestNotifyPassFunction : public TestExtensionFunction { | 26 class TestNotifyPassFunction : public TestExtensionFunction { |
| 27 public: | 27 public: |
| 28 DECLARE_EXTENSION_FUNCTION("test.notifyPass", UNKNOWN) | 28 DECLARE_EXTENSION_FUNCTION("test.notifyPass", UNKNOWN) |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 virtual ~TestNotifyPassFunction(); | 31 virtual ~TestNotifyPassFunction(); |
| 32 | 32 |
| 33 // ExtensionFunction: | 33 // ExtensionFunction: |
| 34 virtual bool RunImpl() OVERRIDE; | 34 virtual bool RunSync() OVERRIDE; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class TestNotifyFailFunction : public TestExtensionFunction { | 37 class TestNotifyFailFunction : public TestExtensionFunction { |
| 38 public: | 38 public: |
| 39 DECLARE_EXTENSION_FUNCTION("test.notifyFail", UNKNOWN) | 39 DECLARE_EXTENSION_FUNCTION("test.notifyFail", UNKNOWN) |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 virtual ~TestNotifyFailFunction(); | 42 virtual ~TestNotifyFailFunction(); |
| 43 | 43 |
| 44 // ExtensionFunction: | 44 // ExtensionFunction: |
| 45 virtual bool RunImpl() OVERRIDE; | 45 virtual bool RunSync() OVERRIDE; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 class TestLogFunction : public TestExtensionFunction { | 48 class TestLogFunction : public TestExtensionFunction { |
| 49 public: | 49 public: |
| 50 DECLARE_EXTENSION_FUNCTION("test.log", UNKNOWN) | 50 DECLARE_EXTENSION_FUNCTION("test.log", UNKNOWN) |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 virtual ~TestLogFunction(); | 53 virtual ~TestLogFunction(); |
| 54 | 54 |
| 55 // ExtensionFunction: | 55 // ExtensionFunction: |
| 56 virtual bool RunImpl() OVERRIDE; | 56 virtual bool RunSync() OVERRIDE; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 class TestResetQuotaFunction : public TestExtensionFunction { | 59 class TestResetQuotaFunction : public TestExtensionFunction { |
| 60 public: | 60 public: |
| 61 DECLARE_EXTENSION_FUNCTION("test.resetQuota", UNKNOWN) | 61 DECLARE_EXTENSION_FUNCTION("test.resetQuota", UNKNOWN) |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 virtual ~TestResetQuotaFunction(); | 64 virtual ~TestResetQuotaFunction(); |
| 65 | 65 |
| 66 // ExtensionFunction: | 66 // ExtensionFunction: |
| 67 virtual bool RunImpl() OVERRIDE; | 67 virtual bool RunSync() OVERRIDE; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 class TestSendMessageFunction : public AsyncExtensionFunction { | 70 class TestSendMessageFunction : public AsyncExtensionFunction { |
| 71 public: | 71 public: |
| 72 DECLARE_EXTENSION_FUNCTION("test.sendMessage", UNKNOWN) | 72 DECLARE_EXTENSION_FUNCTION("test.sendMessage", UNKNOWN) |
| 73 | 73 |
| 74 // Sends a reply back to the calling extension. Many extensions don't need | 74 // Sends a reply back to the calling extension. Many extensions don't need |
| 75 // a reply and will just ignore it. | 75 // a reply and will just ignore it. |
| 76 void Reply(const std::string& message); | 76 void Reply(const std::string& message); |
| 77 | 77 |
| 78 protected: | 78 protected: |
| 79 virtual ~TestSendMessageFunction(); | 79 virtual ~TestSendMessageFunction(); |
| 80 | 80 |
| 81 // ExtensionFunction: | 81 // ExtensionFunction: |
| 82 virtual bool RunImpl() OVERRIDE; | 82 virtual bool RunSync() OVERRIDE; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class TestGetConfigFunction : public SyncExtensionFunction { | 85 class TestGetConfigFunction : public SyncExtensionFunction { |
| 86 public: | 86 public: |
| 87 DECLARE_EXTENSION_FUNCTION("test.getConfig", UNKNOWN) | 87 DECLARE_EXTENSION_FUNCTION("test.getConfig", UNKNOWN) |
| 88 | 88 |
| 89 // Set the dictionary returned by chrome.test.getConfig(). | 89 // Set the dictionary returned by chrome.test.getConfig(). |
| 90 // Does not take ownership of |value|. | 90 // Does not take ownership of |value|. |
| 91 static void set_test_config_state(base::DictionaryValue* value); | 91 static void set_test_config_state(base::DictionaryValue* value); |
| 92 | 92 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 110 TestConfigState(); | 110 TestConfigState(); |
| 111 | 111 |
| 112 base::DictionaryValue* config_state_; | 112 base::DictionaryValue* config_state_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(TestConfigState); | 114 DISALLOW_COPY_AND_ASSIGN(TestConfigState); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 virtual ~TestGetConfigFunction(); | 117 virtual ~TestGetConfigFunction(); |
| 118 | 118 |
| 119 // ExtensionFunction: | 119 // ExtensionFunction: |
| 120 virtual bool RunImpl() OVERRIDE; | 120 virtual bool RunSync() OVERRIDE; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class TestWaitForRoundTripFunction : public TestExtensionFunction { | 123 class TestWaitForRoundTripFunction : public TestExtensionFunction { |
| 124 public: | 124 public: |
| 125 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN) | 125 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN) |
| 126 | 126 |
| 127 protected: | 127 protected: |
| 128 virtual ~TestWaitForRoundTripFunction(); | 128 virtual ~TestWaitForRoundTripFunction(); |
| 129 | 129 |
| 130 // ExtensionFunction: | 130 // ExtensionFunction: |
| 131 virtual bool RunImpl() OVERRIDE; | 131 virtual bool RunSync() OVERRIDE; |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace extensions | 134 } // namespace extensions |
| 135 | 135 |
| 136 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ | 136 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ |
| OLD | NEW |