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

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

Issue 10912041: Disallow packing or loading unpacked manifest v1 extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blarh Created 8 years, 3 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 (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 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 25
26 26
27 // The general flow of these API tests should work like this: 27 // The general flow of these API tests should work like this:
28 // (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
29 // bookmark test) 29 // bookmark test)
30 // (2) Call ASSERT_TRUE(RunExtensionTest(name)); 30 // (2) Call ASSERT_TRUE(RunExtensionTest(name));
31 // (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
32 // chrome.test.fail 32 // chrome.test.fail
33 // (4) Verify expected browser state. 33 // (4) Verify expected browser state.
34 // 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.
35
36 class ExtensionApiTest : public ExtensionBrowserTest { 35 class ExtensionApiTest : public ExtensionBrowserTest {
37 public: 36 public:
38 // Flags used to configure how the tests are run. 37 // Flags used to configure how the tests are run.
38 // TODO(aa): Many of these are dupes of ExtensionBrowserTest::Flags. Combine
39 // somehow?
39 enum Flags { 40 enum Flags {
40 kFlagNone = 0, 41 kFlagNone = 0,
41 42
42 // Allow the extension to run in incognito mode. 43 // Allow the extension to run in incognito mode.
43 kFlagEnableIncognito = 1 << 0, 44 kFlagEnableIncognito = 1 << 0,
44 45
45 // Launch the test page in an incognito window. 46 // Launch the test page in an incognito window.
46 kFlagUseIncognito = 1 << 1, 47 kFlagUseIncognito = 1 << 1,
47 48
48 // Allow file access for the extension. 49 // Allow file access for the extension.
49 kFlagEnableFileAccess = 1 << 2, 50 kFlagEnableFileAccess = 1 << 2,
50 51
51 // Loads the extension with location COMPONENT. 52 // Loads the extension with location COMPONENT.
52 kFlagLoadAsComponent = 1 << 3, 53 kFlagLoadAsComponent = 1 << 3,
53 54
54 // Launch the extension as a platform app. 55 // Launch the extension as a platform app.
55 kFlagLaunchPlatformApp = 1 << 4, 56 kFlagLaunchPlatformApp = 1 << 4,
56 57
57 // Don't fail when the loaded manifest has warnings (should only be used 58 // Don't fail when the loaded manifest has warnings.
58 // when testing deprecated features). 59 kFlagIgnoreManifestWarnings = 1 << 5,
59 kFlagIgnoreManifestWarnings = 1 << 5 60
61 // Allow manifest versions older that Extension::kModernManifestVersion.
62 // Used to test old manifest features.
63 kFlagAllowOldManifestVersions = 1 << 6,
60 }; 64 };
61 65
62 ExtensionApiTest(); 66 ExtensionApiTest();
63 virtual ~ExtensionApiTest(); 67 virtual ~ExtensionApiTest();
64 68
65 protected: 69 protected:
66 // Helper class that observes tests failing or passing. Observation starts 70 // Helper class that observes tests failing or passing. Observation starts
67 // when the class is constructed. Get the next result by calling 71 // when the class is constructed. Get the next result by calling
68 // GetNextResult() and message() if GetNextResult() return false. If there 72 // GetNextResult() and message() if GetNextResult() return false. If there
69 // are no results, this method will pump the UI message loop until one is 73 // are no results, this method will pump the UI message loop until one is
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Load |extension_name| and wait for pass / fail notification. 113 // Load |extension_name| and wait for pass / fail notification.
110 // |extension_name| is a directory in "test/data/extensions/api_test". 114 // |extension_name| is a directory in "test/data/extensions/api_test".
111 bool RunExtensionTest(const char* extension_name); 115 bool RunExtensionTest(const char* extension_name);
112 116
113 // Same as RunExtensionTest, but enables the extension for incognito mode. 117 // Same as RunExtensionTest, but enables the extension for incognito mode.
114 bool RunExtensionTestIncognito(const char* extension_name); 118 bool RunExtensionTestIncognito(const char* extension_name);
115 119
116 // Same as RunExtensionTest, but ignores any warnings in the manifest. 120 // Same as RunExtensionTest, but ignores any warnings in the manifest.
117 bool RunExtensionTestIgnoreManifestWarnings(const char* extension_name); 121 bool RunExtensionTestIgnoreManifestWarnings(const char* extension_name);
118 122
123 // Same as RunExtensionTest, allow old manifest ersions.
124 bool RunExtensionTestAllowOldManifestVersion(const char* extension_name);
125
119 // Same as RunExtensionTest, but loads extension as component. 126 // Same as RunExtensionTest, but loads extension as component.
120 bool RunComponentExtensionTest(const char* extension_name); 127 bool RunComponentExtensionTest(const char* extension_name);
121 128
122 // Same as RunExtensionTest, but disables file access. 129 // Same as RunExtensionTest, but disables file access.
123 bool RunExtensionTestNoFileAccess(const char* extension_name); 130 bool RunExtensionTestNoFileAccess(const char* extension_name);
124 131
125 // Same as RunExtensionTestIncognito, but disables file access. 132 // Same as RunExtensionTestIncognito, but disables file access.
126 bool RunExtensionTestIncognitoNoFileAccess(const char* extension_name); 133 bool RunExtensionTestIncognitoNoFileAccess(const char* extension_name);
127 134
128 // If not empty, Load |extension_name|, load |page_url| and wait for pass / 135 // If not empty, Load |extension_name|, load |page_url| and wait for pass /
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // apps (if any). 191 // apps (if any).
185 class PlatformAppApiTest : public ExtensionApiTest { 192 class PlatformAppApiTest : public ExtensionApiTest {
186 public: 193 public:
187 PlatformAppApiTest(); 194 PlatformAppApiTest();
188 virtual ~PlatformAppApiTest(); 195 virtual ~PlatformAppApiTest();
189 196
190 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; 197 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE;
191 }; 198 };
192 199
193 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 200 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/extension_action/page_action_apitest.cc ('k') | chrome/browser/extensions/extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698