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

Side by Side Diff: chrome/browser/extensions/extension_apitest.h

Issue 10375021: Move Extension into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Take 6 Created 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_APITEST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/extensions/extension_browsertest.h" 14 #include "chrome/browser/extensions/extension_browsertest.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 16
17 class FilePath;
18
19 namespace extensions {
20 class Extension;
21 }
22
17 namespace ui_test_utils { 23 namespace ui_test_utils {
18 class TestWebSocketServer; 24 class TestWebSocketServer;
19 } 25 }
20 26
21 class Extension;
22 class FilePath;
23
24 // The general flow of these API tests should work like this: 27 // The general flow of these API tests should work like this:
25 // (1) Setup initial browser state (e.g. create some bookmarks for the 28 // (1) Setup initial browser state (e.g. create some bookmarks for the
26 // bookmark test) 29 // bookmark test)
27 // (2) Call ASSERT_TRUE(RunExtensionTest(name)); 30 // (2) Call ASSERT_TRUE(RunExtensionTest(name));
28 // (3) In your extension code, run your test and call chrome.test.pass or 31 // (3) In your extension code, run your test and call chrome.test.pass or
29 // chrome.test.fail 32 // chrome.test.fail
30 // (4) Verify expected browser state. 33 // (4) Verify expected browser state.
31 // TODO(erikkay): There should also be a way to drive events in these tests. 34 // TODO(erikkay): There should also be a way to drive events in these tests.
32 35
33 class ExtensionApiTest : public ExtensionBrowserTest { 36 class ExtensionApiTest : public ExtensionBrowserTest {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // will be available to javascript tests using chrome.test.getConfig(). 144 // will be available to javascript tests using chrome.test.getConfig().
142 bool StartTestServer(); 145 bool StartTestServer();
143 146
144 // Start the test WebSocket server, and store details of its state. Those 147 // Start the test WebSocket server, and store details of its state. Those
145 // details will be available to javascript tests using 148 // details will be available to javascript tests using
146 // chrome.test.getConfig(). 149 // chrome.test.getConfig().
147 bool StartWebSocketServer(const FilePath& root_directory); 150 bool StartWebSocketServer(const FilePath& root_directory);
148 151
149 // Test that exactly one extension loaded. If so, return a pointer to 152 // Test that exactly one extension loaded. If so, return a pointer to
150 // the extension. If not, return NULL and set message_. 153 // the extension. If not, return NULL and set message_.
151 const Extension* GetSingleLoadedExtension(); 154 const extensions::Extension* GetSingleLoadedExtension();
152 155
153 // All extensions tested by ExtensionApiTest are in the "api_test" dir. 156 // All extensions tested by ExtensionApiTest are in the "api_test" dir.
154 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; 157 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
155 158
156 // If it failed, what was the error message? 159 // If it failed, what was the error message?
157 std::string message_; 160 std::string message_;
158 161
159 private: 162 private:
160 bool RunExtensionTestImpl(const char* extension_name, 163 bool RunExtensionTestImpl(const char* extension_name,
161 const std::string& test_page, 164 const std::string& test_page,
(...skipping 11 matching lines...) Expand all
173 // apps (if any). 176 // apps (if any).
174 class PlatformAppApiTest : public ExtensionApiTest { 177 class PlatformAppApiTest : public ExtensionApiTest {
175 public: 178 public:
176 PlatformAppApiTest(); 179 PlatformAppApiTest();
177 virtual ~PlatformAppApiTest(); 180 virtual ~PlatformAppApiTest();
178 181
179 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; 182 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
180 }; 183 };
181 184
182 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 185 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_activity_log.cc ('k') | chrome/browser/extensions/extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698