| 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 |
| 11 namespace base { |
| 12 |
| 11 template <typename T> | 13 template <typename T> |
| 12 struct DefaultSingletonTraits; | 14 struct DefaultSingletonTraits; |
| 13 | 15 |
| 16 } // namespace base |
| 17 |
| 14 namespace extensions { | 18 namespace extensions { |
| 15 | 19 |
| 16 // A function that is only available in tests. | 20 // A function that is only available in tests. |
| 17 // Prior to running, checks that we are in a testing process. | 21 // Prior to running, checks that we are in a testing process. |
| 18 class TestExtensionFunction : public SyncExtensionFunction { | 22 class TestExtensionFunction : public SyncExtensionFunction { |
| 19 protected: | 23 protected: |
| 20 ~TestExtensionFunction() override; | 24 ~TestExtensionFunction() override; |
| 21 | 25 |
| 22 // SyncExtensionFunction: | 26 // SyncExtensionFunction: |
| 23 bool RunSync() override; | 27 bool RunSync() override; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 public: | 97 public: |
| 94 static TestConfigState* GetInstance(); | 98 static TestConfigState* GetInstance(); |
| 95 | 99 |
| 96 void set_config_state(base::DictionaryValue* config_state) { | 100 void set_config_state(base::DictionaryValue* config_state) { |
| 97 config_state_ = config_state; | 101 config_state_ = config_state; |
| 98 } | 102 } |
| 99 | 103 |
| 100 const base::DictionaryValue* config_state() { return config_state_; } | 104 const base::DictionaryValue* config_state() { return config_state_; } |
| 101 | 105 |
| 102 private: | 106 private: |
| 103 friend struct DefaultSingletonTraits<TestConfigState>; | 107 friend struct base::DefaultSingletonTraits<TestConfigState>; |
| 104 TestConfigState(); | 108 TestConfigState(); |
| 105 | 109 |
| 106 base::DictionaryValue* config_state_; | 110 base::DictionaryValue* config_state_; |
| 107 | 111 |
| 108 DISALLOW_COPY_AND_ASSIGN(TestConfigState); | 112 DISALLOW_COPY_AND_ASSIGN(TestConfigState); |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 ~TestGetConfigFunction() override; | 115 ~TestGetConfigFunction() override; |
| 112 | 116 |
| 113 // TestExtensionFunction: | 117 // TestExtensionFunction: |
| 114 bool RunSafe() override; | 118 bool RunSafe() override; |
| 115 }; | 119 }; |
| 116 | 120 |
| 117 class TestWaitForRoundTripFunction : public TestExtensionFunction { | 121 class TestWaitForRoundTripFunction : public TestExtensionFunction { |
| 118 public: | 122 public: |
| 119 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN) | 123 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN) |
| 120 | 124 |
| 121 protected: | 125 protected: |
| 122 ~TestWaitForRoundTripFunction() override; | 126 ~TestWaitForRoundTripFunction() override; |
| 123 | 127 |
| 124 // TestExtensionFunction: | 128 // TestExtensionFunction: |
| 125 bool RunSafe() override; | 129 bool RunSafe() override; |
| 126 }; | 130 }; |
| 127 | 131 |
| 128 } // namespace extensions | 132 } // namespace extensions |
| 129 | 133 |
| 130 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ | 134 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ |
| OLD | NEW |