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

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

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test exclusion. Created 7 years, 2 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 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 } 2012 }
2013 } 2013 }
2014 EXPECT_EQ(1, num_prerender_tabs); 2014 EXPECT_EQ(1, num_prerender_tabs);
2015 const string16 prerender_page_title = prerender_title.substr(prefix.length()); 2015 const string16 prerender_page_title = prerender_title.substr(prefix.length());
2016 2016
2017 NavigateToDestURL(); 2017 NavigateToDestURL();
2018 2018
2019 // There should be no tabs with the Prerender prefix. 2019 // There should be no tabs with the Prerender prefix.
2020 const string16 tab_prefix = 2020 const string16 tab_prefix =
2021 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX, string16()); 2021 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_TAB_PREFIX, string16());
2022 const string16 instant_tab_prefix =
2023 l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_INSTANT_OVERLAY_PREFIX,
2024 string16());
2022 num_prerender_tabs = 0; 2025 num_prerender_tabs = 0;
2023 int num_tabs_with_prerender_page_title = 0; 2026 int num_tabs_with_prerender_page_title = 0;
2024 model->Refresh(); 2027 model->Refresh();
2025 for (int i = 0; i < model->ResourceCount(); ++i) { 2028 for (int i = 0; i < model->ResourceCount(); ++i) {
2026 if (model->GetResourceWebContents(i)) { 2029 if (model->GetResourceWebContents(i)) {
2027 string16 tab_title = model->GetResourceTitle(i); 2030 string16 tab_title = model->GetResourceTitle(i);
2028 if (StartsWith(tab_title, prefix, true)) { 2031 if (StartsWith(tab_title, prefix, true)) {
2029 ++num_prerender_tabs; 2032 ++num_prerender_tabs;
2030 } else { 2033 } else if (StartsWith(tab_title, tab_prefix, true)) {
2031 EXPECT_TRUE(StartsWith(tab_title, tab_prefix, true));
2032
2033 // The prerender tab should now be a normal tab but the title should be 2034 // The prerender tab should now be a normal tab but the title should be
2034 // the same. Depending on timing, there may be more than one of these. 2035 // the same. Depending on timing, there may be more than one of these.
2035 const string16 tab_page_title = tab_title.substr(tab_prefix.length()); 2036 const string16 tab_page_title = tab_title.substr(tab_prefix.length());
2036 if (prerender_page_title.compare(tab_page_title) == 0) 2037 if (prerender_page_title.compare(tab_page_title) == 0)
2037 ++num_tabs_with_prerender_page_title; 2038 ++num_tabs_with_prerender_page_title;
2039 } else {
2040 EXPECT_TRUE(StartsWith(tab_title, instant_tab_prefix, true));
2038 } 2041 }
2039 } 2042 }
2040 } 2043 }
2041 EXPECT_EQ(0, num_prerender_tabs); 2044 EXPECT_EQ(0, num_prerender_tabs);
2042 2045
2043 // We may have deleted the prerender tab, but the swapped in tab should be 2046 // We may have deleted the prerender tab, but the swapped in tab should be
2044 // active. 2047 // active.
2045 EXPECT_GE(num_tabs_with_prerender_page_title, 1); 2048 EXPECT_GE(num_tabs_with_prerender_page_title, 1);
2046 EXPECT_LE(num_tabs_with_prerender_page_title, 2); 2049 EXPECT_LE(num_tabs_with_prerender_page_title, 2);
2047 } 2050 }
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
3181 3184
3182 // Checks that deferred redirects in a synchronous XHR abort the 3185 // Checks that deferred redirects in a synchronous XHR abort the
3183 // prerender. 3186 // prerender.
3184 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredSynchronousXHR) { 3187 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDeferredSynchronousXHR) {
3185 PrerenderTestURL("files/prerender/prerender_deferred_sync_xhr.html", 3188 PrerenderTestURL("files/prerender/prerender_deferred_sync_xhr.html",
3186 FINAL_STATUS_BAD_DEFERRED_REDIRECT, 1); 3189 FINAL_STATUS_BAD_DEFERRED_REDIRECT, 1);
3187 NavigateToDestURL(); 3190 NavigateToDestURL();
3188 } 3191 }
3189 3192
3190 } // namespace prerender 3193 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698