summaryrefslogtreecommitdiffstats
path: root/extensions/shell/test
diff options
context:
space:
mode:
authorthiago.santos <thiago.santos@intel.com>2014-12-03 07:17:18 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-03 15:17:42 +0000
commit1625db8fd9fc87933dc24a6f75116198ecdda468 (patch)
tree69728bf4a920b51d7b4d80f3c02c0cc54c3a9235 /extensions/shell/test
parentfc870b224064359844e8686bdaabcda3811bcd39 (diff)
downloadchromium_src-1625db8fd9fc87933dc24a6f75116198ecdda468.zip
chromium_src-1625db8fd9fc87933dc24a6f75116198ecdda468.tar.gz
chromium_src-1625db8fd9fc87933dc24a6f75116198ecdda468.tar.bz2
Move system.storage tests to extensions/
Also add the LoadExtension method to ShellApiTest used by several test cases. This method returns an Extension instance that can be used for recoverying the MainFrame and injecting JavaScript commands. BUG=392842 Review URL: https://codereview.chromium.org/764763003 Cr-Commit-Position: refs/heads/master@{#306607}
Diffstat (limited to 'extensions/shell/test')
-rw-r--r--extensions/shell/test/shell_apitest.cc15
-rw-r--r--extensions/shell/test/shell_apitest.h13
2 files changed, 22 insertions, 6 deletions
diff --git a/extensions/shell/test/shell_apitest.cc b/extensions/shell/test/shell_apitest.cc
index f1ea7a2..8db5aaf 100644
--- a/extensions/shell/test/shell_apitest.cc
+++ b/extensions/shell/test/shell_apitest.cc
@@ -18,18 +18,27 @@ ShellApiTest::ShellApiTest() {
ShellApiTest::~ShellApiTest() {
}
-bool ShellApiTest::RunAppTest(const std::string& app_dir) {
+const Extension* ShellApiTest::LoadApp(const std::string& app_dir) {
base::FilePath test_data_dir;
PathService::Get(extensions::DIR_TEST_DATA, &test_data_dir);
test_data_dir = test_data_dir.AppendASCII(app_dir);
- ResultCatcher catcher;
const Extension* extension = extension_system_->LoadApp(test_data_dir);
if (!extension)
- return false;
+ return NULL;
extension_system_->LaunchApp(extension->id());
+ return extension;
+}
+
+bool ShellApiTest::RunAppTest(const std::string& app_dir) {
+ ResultCatcher catcher;
+
+ const Extension* extension = LoadApp(app_dir);
+ if (!extension)
+ return false;
+
if (!catcher.GetNextResult()) {
message_ = catcher.message();
return false;
diff --git a/extensions/shell/test/shell_apitest.h b/extensions/shell/test/shell_apitest.h
index 3688384..09475e5 100644
--- a/extensions/shell/test/shell_apitest.h
+++ b/extensions/shell/test/shell_apitest.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_SHELL_TEST_SHELL_API_TEST_H_
-#define EXTENSIONS_SHELL_TEST_SHELL_API_TEST_H_
+#ifndef EXTENSIONS_SHELL_TEST_SHELL_APITEST_H_
+#define EXTENSIONS_SHELL_TEST_SHELL_APITEST_H_
#include <string>
@@ -11,6 +11,8 @@
namespace extensions {
+class Extension;
+
// Base class for app shell browser API tests that load an app/extension
// and wait for a success message from the chrome.test API.
class ShellApiTest : public AppShellTest {
@@ -18,6 +20,11 @@ class ShellApiTest : public AppShellTest {
ShellApiTest();
~ShellApiTest() override;
+ // Load and run an unpacked platform app from the |app_dir| directory. Unlike
+ // |RunAppTest|, it won't wait automatically for any kind of notification.
+ // Returns an instance of the extension that was just loaded.
+ const Extension* LoadApp(const std::string& app_dir);
+
// Loads an unpacked platform app from a directory using the current
// ExtensionSystem, launches it, and waits for a chrome.test success
// notification. Returns true if the test succeeds. |app_dir| is a
@@ -34,4 +41,4 @@ class ShellApiTest : public AppShellTest {
} // namespace extensions
-#endif // EXTENSIONS_SHELL_TEST_SHELL_API_TEST_H_
+#endif // EXTENSIONS_SHELL_TEST_SHELL_APITEST_H_