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

Unified Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 6948002: Change TaskManager test to be in line with new TabContents lifetime uncertainty when Prerendering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_browsertest.cc
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index bbea33c53abe01269e620115fe7612c2b8f01af8..1f3b3861712d02e20616f61d99d443b4935a8446 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -713,30 +713,41 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, TaskManager) {
EXPECT_EQ(2, model()->ResourceCount());
PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
- // The prerender makes three.
- EXPECT_EQ(3, model()->ResourceCount());
-
- // It should have a TabContents associated with it.
- ASSERT_TRUE(model()->GetResourceTabContents(1) != NULL);
-
- // The prefix should be "Prerender:"
- string16 prefix =
+ // The prerender makes three but we may have another Tab that we haven't
+ // deleted yet.
+ EXPECT_GE(model()->ResourceCount(), 3);
mmenke 2011/05/06 16:08:09 Shouldn't we always have 4 here? Browser, old (st
+ EXPECT_LE(model()->ResourceCount(), 4);
+
+ // One of the resources that has a TabContents associated with it should have
+ // the Prerender prefix.
+ const string16 prefix =
l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX,
string16());
- ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
+ int num_prerender_tabs = 0;
+ for (int i = 0; i < model()->ResourceCount(); ++i) {
+ if (model()->GetResourceTabContents(i) &&
+ StartsWith(model()->GetResourceTitle(i), prefix, true)) {
+ ++num_prerender_tabs;
+ }
+ }
+ ASSERT_EQ(1, num_prerender_tabs);
NavigateToDestURL();
- // Prerender task should become a normal tab.
- EXPECT_EQ(3, model()->ResourceCount());
-
- // It should have a TabContents associated with it.
- ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL);
-
- // The prefix should now be "Tab:"
- prefix = l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX,
- string16());
- ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
+ // Prerender task should become a normal tab but we still may not have deleted
+ // the old one.
+ EXPECT_GE(model()->ResourceCount(), 3);
+ EXPECT_LE(model()->ResourceCount(), 4);
+
+ // There should be no Tabs with the Prerender prefix.
+ num_prerender_tabs = 0;
+ for (int i = 0; i < model()->ResourceCount(); ++i) {
+ if (model()->GetResourceTabContents(i) &&
+ StartsWith(model()->GetResourceTitle(i), prefix, true)) {
+ ++num_prerender_tabs;
+ }
+ }
+ ASSERT_EQ(0, num_prerender_tabs);
}
// Checks that prerenderers will terminate when an audio tag is encountered.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698