Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Side by Side Diff: extensions/browser/api/test/test_api.h

Issue 252653002: Rename (Chrome)SyncExtensionFunction::RunImpl to RunSync so that the RunImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bookmarks Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 template <typename T> 11 template <typename T>
12 struct DefaultSingletonTraits; 12 struct DefaultSingletonTraits;
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 // A function that is only available in tests. 16 // A function that is only available in tests.
17 // Prior to running, checks that we are in a testing process. 17 // Prior to running, checks that we are in a testing process.
18 class TestExtensionFunction : public SyncExtensionFunction { 18 class TestExtensionFunction : public SyncExtensionFunction {
19 protected: 19 protected:
20 virtual ~TestExtensionFunction(); 20 virtual ~TestExtensionFunction();
21 21
22 // ExtensionFunction: 22 // SyncExtensionFunction:
23 virtual void Run() OVERRIDE; 23 virtual bool RunSync() OVERRIDE;
24
25 virtual bool RunSafe() = 0;
24 }; 26 };
25 27
26 class TestNotifyPassFunction : public TestExtensionFunction { 28 class TestNotifyPassFunction : public TestExtensionFunction {
27 public: 29 public:
28 DECLARE_EXTENSION_FUNCTION("test.notifyPass", UNKNOWN) 30 DECLARE_EXTENSION_FUNCTION("test.notifyPass", UNKNOWN)
29 31
30 protected: 32 protected:
31 virtual ~TestNotifyPassFunction(); 33 virtual ~TestNotifyPassFunction();
32 34
33 // ExtensionFunction: 35 // TestExtensionFunction:
34 virtual bool RunImpl() OVERRIDE; 36 virtual bool RunSafe() OVERRIDE;
35 }; 37 };
36 38
37 class TestNotifyFailFunction : public TestExtensionFunction { 39 class TestNotifyFailFunction : public TestExtensionFunction {
38 public: 40 public:
39 DECLARE_EXTENSION_FUNCTION("test.notifyFail", UNKNOWN) 41 DECLARE_EXTENSION_FUNCTION("test.notifyFail", UNKNOWN)
40 42
41 protected: 43 protected:
42 virtual ~TestNotifyFailFunction(); 44 virtual ~TestNotifyFailFunction();
43 45
44 // ExtensionFunction: 46 // TestExtensionFunction:
45 virtual bool RunImpl() OVERRIDE; 47 virtual bool RunSafe() OVERRIDE;
46 }; 48 };
47 49
48 class TestLogFunction : public TestExtensionFunction { 50 class TestLogFunction : public TestExtensionFunction {
49 public: 51 public:
50 DECLARE_EXTENSION_FUNCTION("test.log", UNKNOWN) 52 DECLARE_EXTENSION_FUNCTION("test.log", UNKNOWN)
51 53
52 protected: 54 protected:
53 virtual ~TestLogFunction(); 55 virtual ~TestLogFunction();
54 56
55 // ExtensionFunction: 57 // TestExtensionFunction:
56 virtual bool RunImpl() OVERRIDE; 58 virtual bool RunSafe() OVERRIDE;
57 }; 59 };
58 60
59 class TestResetQuotaFunction : public TestExtensionFunction { 61 class TestResetQuotaFunction : public TestExtensionFunction {
60 public: 62 public:
61 DECLARE_EXTENSION_FUNCTION("test.resetQuota", UNKNOWN) 63 DECLARE_EXTENSION_FUNCTION("test.resetQuota", UNKNOWN)
62 64
63 protected: 65 protected:
64 virtual ~TestResetQuotaFunction(); 66 virtual ~TestResetQuotaFunction();
65 67
66 // ExtensionFunction: 68 // TestExtensionFunction:
67 virtual bool RunImpl() OVERRIDE; 69 virtual bool RunSafe() OVERRIDE;
68 }; 70 };
69 71
70 class TestSendMessageFunction : public AsyncExtensionFunction { 72 class TestSendMessageFunction : public AsyncExtensionFunction {
71 public: 73 public:
72 DECLARE_EXTENSION_FUNCTION("test.sendMessage", UNKNOWN) 74 DECLARE_EXTENSION_FUNCTION("test.sendMessage", UNKNOWN)
73 75
74 // Sends a reply back to the calling extension. Many extensions don't need 76 // Sends a reply back to the calling extension. Many extensions don't need
75 // a reply and will just ignore it. 77 // a reply and will just ignore it.
76 void Reply(const std::string& message); 78 void Reply(const std::string& message);
77 79
78 protected: 80 protected:
79 virtual ~TestSendMessageFunction(); 81 virtual ~TestSendMessageFunction();
80 82
81 // ExtensionFunction: 83 // ExtensionFunction:
82 virtual bool RunImpl() OVERRIDE; 84 virtual bool RunImpl() OVERRIDE;
83 }; 85 };
84 86
85 class TestGetConfigFunction : public SyncExtensionFunction { 87 class TestGetConfigFunction : public TestExtensionFunction {
86 public: 88 public:
87 DECLARE_EXTENSION_FUNCTION("test.getConfig", UNKNOWN) 89 DECLARE_EXTENSION_FUNCTION("test.getConfig", UNKNOWN)
88 90
89 // Set the dictionary returned by chrome.test.getConfig(). 91 // Set the dictionary returned by chrome.test.getConfig().
90 // Does not take ownership of |value|. 92 // Does not take ownership of |value|.
91 static void set_test_config_state(base::DictionaryValue* value); 93 static void set_test_config_state(base::DictionaryValue* value);
92 94
93 protected: 95 protected:
94 // Tests that set configuration state do so by calling 96 // Tests that set configuration state do so by calling
95 // set_test_config_state() as part of test set up, and unsetting it 97 // set_test_config_state() as part of test set up, and unsetting it
(...skipping 13 matching lines...) Expand all
109 friend struct DefaultSingletonTraits<TestConfigState>; 111 friend struct DefaultSingletonTraits<TestConfigState>;
110 TestConfigState(); 112 TestConfigState();
111 113
112 base::DictionaryValue* config_state_; 114 base::DictionaryValue* config_state_;
113 115
114 DISALLOW_COPY_AND_ASSIGN(TestConfigState); 116 DISALLOW_COPY_AND_ASSIGN(TestConfigState);
115 }; 117 };
116 118
117 virtual ~TestGetConfigFunction(); 119 virtual ~TestGetConfigFunction();
118 120
119 // ExtensionFunction: 121 // TestExtensionFunction:
120 virtual bool RunImpl() OVERRIDE; 122 virtual bool RunSafe() OVERRIDE;
121 }; 123 };
122 124
123 class TestWaitForRoundTripFunction : public TestExtensionFunction { 125 class TestWaitForRoundTripFunction : public TestExtensionFunction {
124 public: 126 public:
125 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN) 127 DECLARE_EXTENSION_FUNCTION("test.waitForRoundTrip", UNKNOWN)
126 128
127 protected: 129 protected:
128 virtual ~TestWaitForRoundTripFunction(); 130 virtual ~TestWaitForRoundTripFunction();
129 131
130 // ExtensionFunction: 132 // TestExtensionFunction:
131 virtual bool RunImpl() OVERRIDE; 133 virtual bool RunSafe() OVERRIDE;
132 }; 134 };
133 135
134 } // namespace extensions 136 } // namespace extensions
135 137
136 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_ 138 #endif // EXTENSIONS_BROWSER_API_TEST_TEST_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/speech/extension_api/tts_extension_api.cc ('k') | extensions/browser/api/test/test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698