summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 20:21:08 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-23 20:21:08 +0000
commitff65139ad41289aa2e62637b16e2dc1a744528c7 (patch)
tree7b8b620095589c06823952b54ebbb718955535fa /chrome/browser/extensions
parent94a1d6a282d6ab09f2388bc99f25faabff14bd31 (diff)
downloadchromium_src-ff65139ad41289aa2e62637b16e2dc1a744528c7.zip
chromium_src-ff65139ad41289aa2e62637b16e2dc1a744528c7.tar.gz
chromium_src-ff65139ad41289aa2e62637b16e2dc1a744528c7.tar.bz2
Split captureVisibleTab() tests into jpeg and png tests, to avoid timeouts.
BUG=49040 TEST=ExtensionApiTest.CaptureVisibleTab* Review URL: http://codereview.chromium.org/3050014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53503 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/extension_apitest.cc26
-rw-r--r--chrome/browser/extensions/extension_apitest.h10
-rw-r--r--chrome/browser/extensions/extension_tabs_apitest.cc19
3 files changed, 43 insertions, 12 deletions
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index cc16957..70708c8 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -60,16 +60,38 @@ void ExtensionApiTest::ResultCatcher::Observe(
}
}
-// Load an extension and wait for it to notify of PASSED or FAILED.
bool ExtensionApiTest::RunExtensionTest(const char* extension_name) {
- ResultCatcher catcher;
+ return RunExtensionTestImpl(extension_name, "");
+}
+bool ExtensionApiTest::RunExtensionSubtest(const char* extension_name,
+ const std::string& subtest_page) {
+ DCHECK(!subtest_page.empty()) << "Argument subtest_page is required.";
+ return RunExtensionTestImpl(extension_name, subtest_page);
+}
+
+// Load an extension and wait for it to notify of PASSED or FAILED.
+bool ExtensionApiTest::RunExtensionTestImpl(const char* extension_name,
+ const std::string& subtest_page) {
+ ResultCatcher catcher;
LOG(INFO) << "Running ExtensionApiTest with: " << extension_name;
+
if (!LoadExtension(test_data_dir_.AppendASCII(extension_name))) {
message_ = "Failed to load extension.";
return false;
}
+ // If there is a subtest to load, navigate to teh subtest page.
+ if (!subtest_page.empty()) {
+ Extension* extension = GetSingleLoadedExtension();
+ if (!extension)
+ return false; // message_ was set by GetSingleLoadedExtension().
+
+ GURL url = extension->GetResourceURL(subtest_page);
+ LOG(ERROR) << "Loading subtest page url: " << url.spec();
+ ui_test_utils::NavigateToURL(browser(), url);
+ }
+
if (!catcher.GetNextResult()) {
message_ = catcher.message();
return false;
diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h
index bd05fe5..3ef956a 100644
--- a/chrome/browser/extensions/extension_apitest.h
+++ b/chrome/browser/extensions/extension_apitest.h
@@ -55,6 +55,12 @@ class ExtensionApiTest : public ExtensionBrowserTest {
// |extension_name| is a directory in "test/data/extensions/api_test".
bool RunExtensionTest(const char* extension_name);
+ // Load |extension_name|, load page at path |subtest_page| under the
+ // extension, and wait for pass / fail notification. |extension_name|
+ // is a directory in "test/data/extensions/api_test".
+ bool RunExtensionSubtest(const char* extension_name,
+ const std::string& subtest_page);
+
// Test that exactly one extension loaded. If so, return a pointer to
// the extension. If not, return NULL and set message_.
Extension* GetSingleLoadedExtension();
@@ -64,6 +70,10 @@ class ExtensionApiTest : public ExtensionBrowserTest {
// If it failed, what was the error message?
std::string message_;
+
+ private:
+ bool RunExtensionTestImpl(const char* extension_name,
+ const std::string& test_page);
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc
index 5444386..5331913 100644
--- a/chrome/browser/extensions/extension_tabs_apitest.cc
+++ b/chrome/browser/extensions/extension_tabs_apitest.cc
@@ -25,14 +25,6 @@
#define MAYBE_TabOnRemoved TabOnRemoved
#endif
-// CaptureVisibleTab fails on karmic 64 bit.
-// http://crbug.com/49040
-#if defined(OS_LINUX) && defined(__x86_64__) && !defined(NDEBUG)
-#define MAYBE_CaptureVisibleTab FLAKY_CaptureVisibleTab
-#else
-#define MAYBE_CaptureVisibleTab CaptureVisibleTab
-#endif
-
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Tabs) {
ASSERT_TRUE(StartHTTPServer());
@@ -60,9 +52,16 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_TabOnRemoved) {
ASSERT_TRUE(RunExtensionTest("tabs/on_removed")) << message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_CaptureVisibleTab) {
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CaptureVisibleTabJpeg) {
+ ASSERT_TRUE(StartHTTPServer());
+ ASSERT_TRUE(RunExtensionSubtest("tabs/capture_visible_tab",
+ "test_jpeg.html")) << message_;
+}
+
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, CaptureVisibleTabPng) {
ASSERT_TRUE(StartHTTPServer());
- ASSERT_TRUE(RunExtensionTest("tabs/capture_visible_tab")) << message_;
+ ASSERT_TRUE(RunExtensionSubtest("tabs/capture_visible_tab",
+ "test_png.html")) << message_;
}
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, TabsOnUpdated) {