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/singleton.h" | 9 #include "base/singleton.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 47 matching lines...) Loading... |
58 // Does not take ownership of |value|. | 58 // Does not take ownership of |value|. |
59 static void set_test_config_state(DictionaryValue* value); | 59 static void set_test_config_state(DictionaryValue* value); |
60 | 60 |
61 private: | 61 private: |
62 // Tests that set configuration state do so by calling | 62 // Tests that set configuration state do so by calling |
63 // set_test_config_state() as part of test set up, and unsetting it | 63 // set_test_config_state() as part of test set up, and unsetting it |
64 // during tear down. This singleton class holds a pointer to that | 64 // during tear down. This singleton class holds a pointer to that |
65 // state, owned by the test code. | 65 // state, owned by the test code. |
66 class TestConfigState { | 66 class TestConfigState { |
67 public: | 67 public: |
| 68 static TestConfigState* GetInstance(); |
| 69 |
68 void set_config_state(DictionaryValue* config_state) { | 70 void set_config_state(DictionaryValue* config_state) { |
69 config_state_ = config_state; | 71 config_state_ = config_state; |
70 } | 72 } |
71 const DictionaryValue* config_state() { | 73 const DictionaryValue* config_state() { |
72 return config_state_; | 74 return config_state_; |
73 } | 75 } |
74 private: | 76 private: |
75 friend struct DefaultSingletonTraits<TestConfigState>; | 77 friend struct DefaultSingletonTraits<TestConfigState>; |
76 TestConfigState(); | 78 TestConfigState(); |
77 DictionaryValue* config_state_; | 79 DictionaryValue* config_state_; |
78 DISALLOW_COPY_AND_ASSIGN(TestConfigState); | 80 DISALLOW_COPY_AND_ASSIGN(TestConfigState); |
79 }; | 81 }; |
80 | 82 |
81 ~ExtensionTestGetConfigFunction(); | 83 ~ExtensionTestGetConfigFunction(); |
82 virtual bool RunImpl(); | 84 virtual bool RunImpl(); |
83 DECLARE_EXTENSION_FUNCTION_NAME("test.getConfig") | 85 DECLARE_EXTENSION_FUNCTION_NAME("test.getConfig") |
84 }; | 86 }; |
85 | 87 |
86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ | 88 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_API_H_ |
OLD | NEW |