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

Unified Diff: chrome/browser/extensions/extension_apitest.h

Issue 171032: end-to-end extension API tests (Closed)
Patch Set: a bit of refactoring and review feedback Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_apitest.cc » ('j') | chrome/chrome.gyp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_apitest.h
diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e1885b21d8bbb5bb6a92466539a79923ac6cb0c
--- /dev/null
+++ b/chrome/browser/extensions/extension_apitest.h
@@ -0,0 +1,47 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
+
+#include "chrome/browser/extensions/extension_browsertest.h"
+#include "chrome/common/notification_service.h"
+
+// The general flow of these API tests should work like this:
+// (1) Setup initial browser state (e.g. create some bookmarks for the
+// bookmark test)
+// (2) Call ASSERT_TRUE(RunExtensionTest(name));
+// (3) In your extension code, run your test and call chrome.test.pass or
+// chrome.test.fail
+// (4) Verify expected browser state.
+// TODO(erikkay): There should also be a way to drive events in these tests.
+
+class ExtensionApiTest : public ExtensionBrowserTest {
+ protected:
+ // Load |extension_name| and wait for pass / fail notification.
+ // |extension_name| is a directory in "test/data/extensions/api_test".
+ bool RunExtensionTest(const char* extension_name);
+
+ // Reset |completed_| and wait for a new pass / fail notification.
+ bool WaitForPassFail();
+
+ // All extensions tested by ExtensionApiTest are in the "api_test" dir.
+ virtual void SetUpCommandLine(CommandLine* command_line);
+
+ // NotificationObserver
+ void ExtensionApiTest::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ // Did the extension side of the unit test complete?
+ bool completed_;
+
+ // Did the extension side of the unit test pass?
+ bool passed_;
+
+ // If it failed, what was the error message?
+ std::string message_;
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_apitest.cc » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698