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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 10790062: [Panels refactor] Track Panels in TaskManager now that they are not under the tab contents umbrella. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <deque> 5 #include <deque>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 1502
1503 // One of the resources that has a WebContents associated with it should have 1503 // One of the resources that has a WebContents associated with it should have
1504 // the Prerender prefix. 1504 // the Prerender prefix.
1505 const string16 prefix = 1505 const string16 prefix =
1506 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16()); 1506 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PRERENDER_PREFIX, string16());
1507 string16 prerender_title; 1507 string16 prerender_title;
1508 int num_prerender_tabs = 0; 1508 int num_prerender_tabs = 0;
1509 1509
1510 const TaskManagerModel* model = GetModel(); 1510 const TaskManagerModel* model = GetModel();
1511 for (int i = 0; i < model->ResourceCount(); ++i) { 1511 for (int i = 0; i < model->ResourceCount(); ++i) {
1512 if (model->GetResourceTabContents(i)) { 1512 if (model->GetResourceWebContents(i)) {
1513 prerender_title = model->GetResourceTitle(i); 1513 prerender_title = model->GetResourceTitle(i);
1514 if (StartsWith(prerender_title, prefix, true)) 1514 if (StartsWith(prerender_title, prefix, true))
1515 ++num_prerender_tabs; 1515 ++num_prerender_tabs;
1516 } 1516 }
1517 } 1517 }
1518 EXPECT_EQ(1, num_prerender_tabs); 1518 EXPECT_EQ(1, num_prerender_tabs);
1519 const string16 prerender_page_title = prerender_title.substr(prefix.length()); 1519 const string16 prerender_page_title = prerender_title.substr(prefix.length());
1520 1520
1521 NavigateToDestURL(); 1521 NavigateToDestURL();
1522 1522
1523 // There should be no tabs with the Prerender prefix. 1523 // There should be no tabs with the Prerender prefix.
1524 const string16 tab_prefix = 1524 const string16 tab_prefix =
1525 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX, string16()); 1525 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX, string16());
1526 num_prerender_tabs = 0; 1526 num_prerender_tabs = 0;
1527 int num_tabs_with_prerender_page_title = 0; 1527 int num_tabs_with_prerender_page_title = 0;
1528 for (int i = 0; i < model->ResourceCount(); ++i) { 1528 for (int i = 0; i < model->ResourceCount(); ++i) {
1529 if (model->GetResourceTabContents(i)) { 1529 if (model->GetResourceWebContents(i)) {
1530 string16 tab_title = model->GetResourceTitle(i); 1530 string16 tab_title = model->GetResourceTitle(i);
1531 if (StartsWith(tab_title, prefix, true)) { 1531 if (StartsWith(tab_title, prefix, true)) {
1532 ++num_prerender_tabs; 1532 ++num_prerender_tabs;
1533 } else { 1533 } else {
1534 EXPECT_TRUE(StartsWith(tab_title, tab_prefix, true)); 1534 EXPECT_TRUE(StartsWith(tab_title, tab_prefix, true));
1535 1535
1536 // The prerender tab should now be a normal tab but the title should be 1536 // The prerender tab should now be a normal tab but the title should be
1537 // the same. Depending on timing, there may be more than one of these. 1537 // the same. Depending on timing, there may be more than one of these.
1538 const string16 tab_page_title = tab_title.substr(tab_prefix.length()); 1538 const string16 tab_page_title = tab_title.substr(tab_prefix.length());
1539 if (prerender_page_title.compare(tab_page_title) == 0) 1539 if (prerender_page_title.compare(tab_page_title) == 0)
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 ResultCatcher catcher; 2303 ResultCatcher catcher;
2304 2304
2305 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1); 2305 PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
2306 NavigateToDestURL(); 2306 NavigateToDestURL();
2307 ASSERT_TRUE(IsEmptyPrerenderLinkManager()); 2307 ASSERT_TRUE(IsEmptyPrerenderLinkManager());
2308 2308
2309 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); 2309 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
2310 } 2310 }
2311 2311
2312 } // namespace prerender 2312 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698