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

Side by Side Diff: chrome/browser/errorpage_browsertest.cc

Issue 1815363002: Add RetainedRef uses where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 // cache. 940 // cache.
941 GURL test_url(embedded_test_server()->GetURL("/nocache.html")); 941 GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
942 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); 942 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
943 943
944 // Reload same URL after forcing an error from the the network layer; 944 // Reload same URL after forcing an error from the the network layer;
945 // confirm that the error page is told the cached copy exists. 945 // confirm that the error page is told the cached copy exists.
946 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = 946 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter =
947 browser()->profile()->GetRequestContext(); 947 browser()->profile()->GetRequestContext();
948 BrowserThread::PostTask( 948 BrowserThread::PostTask(
949 BrowserThread::IO, FROM_HERE, 949 BrowserThread::IO, FROM_HERE,
950 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, 950 base::Bind(&InterceptNetworkTransactions,
951 base::RetainedRef(url_request_context_getter),
951 net::ERR_FAILED)); 952 net::ERR_FAILED));
952 953
953 // With no navigation corrections to load, there's only one navigation. 954 // With no navigation corrections to load, there's only one navigation.
954 ui_test_utils::NavigateToURL(browser(), test_url); 955 ui_test_utils::NavigateToURL(browser(), test_url);
955 EXPECT_TRUE(ProbeStaleCopyValue(true)); 956 EXPECT_TRUE(ProbeStaleCopyValue(true));
956 EXPECT_TRUE(IsDisplayingText(browser(), GetShowSavedButtonLabel())); 957 EXPECT_TRUE(IsDisplayingText(browser(), GetShowSavedButtonLabel()));
957 EXPECT_NE(base::ASCIIToUTF16("Nocache Test Page"), 958 EXPECT_NE(base::ASCIIToUTF16("Nocache Test Page"),
958 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); 959 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
959 960
960 // Confirm that loading the stale copy from the cache works. 961 // Confirm that loading the stale copy from the cache works.
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 // cache. 1222 // cache.
1222 GURL test_url(embedded_test_server()->GetURL("/nocache.html")); 1223 GURL test_url(embedded_test_server()->GetURL("/nocache.html"));
1223 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1); 1224 NavigateToURLAndWaitForTitle(test_url, "Nocache Test Page", 1);
1224 1225
1225 // Reload same URL after forcing an error from the the network layer; 1226 // Reload same URL after forcing an error from the the network layer;
1226 // confirm that the error page is told the cached copy exists. 1227 // confirm that the error page is told the cached copy exists.
1227 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter = 1228 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter =
1228 browser()->profile()->GetRequestContext(); 1229 browser()->profile()->GetRequestContext();
1229 BrowserThread::PostTask( 1230 BrowserThread::PostTask(
1230 BrowserThread::IO, FROM_HERE, 1231 BrowserThread::IO, FROM_HERE,
1231 base::Bind(&InterceptNetworkTransactions, url_request_context_getter, 1232 base::Bind(&InterceptNetworkTransactions,
1233 base::RetainedRef(url_request_context_getter),
1232 net::ERR_CONNECTION_FAILED)); 1234 net::ERR_CONNECTION_FAILED));
1233 1235
1234 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 1236 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
1235 browser(), test_url, 2); 1237 browser(), test_url, 2);
1236 EXPECT_TRUE(IsDisplayingText(browser(), GetShowSavedButtonLabel())); 1238 EXPECT_TRUE(IsDisplayingText(browser(), GetShowSavedButtonLabel()));
1237 EXPECT_TRUE(ProbeStaleCopyValue(true)); 1239 EXPECT_TRUE(ProbeStaleCopyValue(true));
1238 1240
1239 // Confirm that loading the stale copy from the cache works. 1241 // Confirm that loading the stale copy from the cache works.
1240 content::TestNavigationObserver same_tab_observer( 1242 content::TestNavigationObserver same_tab_observer(
1241 browser()->tab_strip_model()->GetActiveWebContents(), 1); 1243 browser()->tab_strip_model()->GetActiveWebContents(), 1);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 IN_PROC_BROWSER_TEST_F(ErrorPageForIDNTest, IDN) { 1458 IN_PROC_BROWSER_TEST_F(ErrorPageForIDNTest, IDN) {
1457 // ERR_UNSAFE_PORT will not trigger navigation corrections. 1459 // ERR_UNSAFE_PORT will not trigger navigation corrections.
1458 ui_test_utils::NavigateToURL( 1460 ui_test_utils::NavigateToURL(
1459 browser(), 1461 browser(),
1460 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT, 1462 URLRequestFailedJob::GetMockHttpUrlForHostname(net::ERR_UNSAFE_PORT,
1461 kHostname)); 1463 kHostname));
1462 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode)); 1464 EXPECT_TRUE(IsDisplayingText(browser(), kHostnameJSUnicode));
1463 } 1465 }
1464 1466
1465 } // namespace 1467 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698