summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_browsertests_misc.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 22:14:40 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-03 22:14:40 +0000
commit00c1a1272e75dba35f1d8d0b486f3852584ac8c1 (patch)
tree563dfc8d63fd58ddd467a540520bbe67496c5703 /chrome/browser/extensions/extension_browsertests_misc.cc
parent1213d30119eacc18bd605138f59388f0db0883bc (diff)
downloadchromium_src-00c1a1272e75dba35f1d8d0b486f3852584ac8c1.zip
chromium_src-00c1a1272e75dba35f1d8d0b486f3852584ac8c1.tar.gz
chromium_src-00c1a1272e75dba35f1d8d0b486f3852584ac8c1.tar.bz2
Adjust the test for the RSS extensions a little.
Do the testing in two steps instead of one: 1) Load the feed data and just verify that the extension detects the feed and shows a new tab. If that passes: 2) Directly load the feed data synchronously into the preview tab and validate the data. Using this approach I can immediately validate the data after navigating and don't have to rely on polling. I'll look into removing the FLAKY label after I'm confident this works on the build bots. BUG=http://crbug.com/37109 TEST=This contains test changes. Review URL: http://codereview.chromium.org/667004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_browsertests_misc.cc')
-rw-r--r--chrome/browser/extensions/extension_browsertests_misc.cc52
1 files changed, 19 insertions, 33 deletions
diff --git a/chrome/browser/extensions/extension_browsertests_misc.cc b/chrome/browser/extensions/extension_browsertests_misc.cc
index fa5b30c..112f3d1 100644
--- a/chrome/browser/extensions/extension_browsertests_misc.cc
+++ b/chrome/browser/extensions/extension_browsertests_misc.cc
@@ -389,26 +389,12 @@ bool ValidatePageElement(TabContents* tab,
std::string returned_value;
std::string error;
- // We are testing the actual feed sniffing + redirecting to the preview page
- // so we can't pass the 'synchronous' test flag that we use for malformed
- // feeds. Furthermore, the subscribe page loads resources such as the feed
- // data asynchronously and we have no signals from the extension telling us
- // when it is done loading resources, so we need to check and retry if we
- // don't get the expected value.
- int retries = 10;
- while (retries--) {
- if (!ui_test_utils::ExecuteJavaScriptAndExtractString(
- tab->render_view_host(),
- frame,
- javascript, &returned_value))
- return false;
- if (expected_value == returned_value)
- break; // We are done.
-
- MessageLoopForUI::current()->PostDelayedTask(
- FROM_HERE, new MessageLoop::QuitTask(), 500);
- ui_test_utils::RunMessageLoop();
- }
+ if (!ui_test_utils::ExecuteJavaScriptAndExtractString(
+ tab->render_view_host(),
+ frame,
+ javascript, &returned_value))
+ return false;
+
EXPECT_STREQ(expected_value.c_str(), returned_value.c_str());
return expected_value == returned_value;
}
@@ -425,27 +411,27 @@ void NavigateToFeedAndValidate(HTTPTestServer* server,
const std::string& expected_item_title,
const std::string& expected_item_desc,
const std::string& expected_error) {
- std::string extension_id;
- if (!sniff_xml_type) {
- // There should be only one extension in the list (ours). Get its id.
- ExtensionsService* service = browser->profile()->GetExtensionsService();
- ASSERT_EQ(1u, service->extensions()->size());
- Extension* extension = (*service->extensions())[0];
- extension_id = extension->id();
- }
-
- ui_test_utils::NavigateToURL(browser,
- GetFeedUrl(server, url,
- !sniff_xml_type, extension_id));
-
if (sniff_xml_type) {
// Navigate to the feed will cause the extension to sniff the type and
// create an extra tab showing the feed preview.
+ ui_test_utils::NavigateToURL(browser, GetFeedUrl(server, url, false, ""));
+
+ // Validate that we have a new tab.
TabStripModel* tab_strip = browser->tabstrip_model();
if (tab_strip->count() == 1)
ui_test_utils::WaitForTabParented();
+ ASSERT_EQ(2, tab_strip->count());
}
+ // There should be only one extension in the list (ours). Get its id.
+ ExtensionsService* service = browser->profile()->GetExtensionsService();
+ ASSERT_EQ(1u, service->extensions()->size());
+ Extension* extension = (*service->extensions())[0];
+ std::string id = extension->id();
+
+ // Navigate to the subscribe page directly.
+ ui_test_utils::NavigateToURL(browser, GetFeedUrl(server, url, true, id));
+
TabContents* tab = browser->GetSelectedTabContents();
ASSERT_TRUE(ValidatePageElement(tab,
L"",