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

Side by Side Diff: content/browser/renderer_host/render_view_host_manager_browsertest.cc

Issue 6724026: Clean up unload-related state after the ack is received. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with test flakiness fix CL. Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "chrome/browser/download/download_manager.h" 8 #include "chrome/browser/download/download_manager.h"
9 #include "chrome/browser/extensions/extension_error_reporter.h" 9 #include "chrome/browser/extensions/extension_error_reporter.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 &result)); 280 &result));
281 EXPECT_TRUE(result); 281 EXPECT_TRUE(result);
282 ui_test_utils::NavigateToURL(browser(), zip_url); 282 ui_test_utils::NavigateToURL(browser(), zip_url);
283 283
284 ui_test_utils::WaitForDownloadCount( 284 ui_test_utils::WaitForDownloadCount(
285 browser()->profile()->GetDownloadManager(), 1); 285 browser()->profile()->GetDownloadManager(), 1);
286 286
287 browser()->CloseWindow(); 287 browser()->CloseWindow();
288 BrowserClosedObserver wait_for_close(browser()); 288 BrowserClosedObserver wait_for_close(browser());
289 } 289 }
290
291 // Test for crbug.com/76666. A cross-site navigation that fails with a 204
292 // error should not make us ignore future renderer-initiated navigations.
293 IN_PROC_BROWSER_TEST_F(RenderViewHostManagerTest, ClickLinkAfter204Error) {
294 // Start two servers with different sites.
295 ASSERT_TRUE(test_server()->Start());
296 net::TestServer https_server(
297 net::TestServer::TYPE_HTTPS,
298 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
299 ASSERT_TRUE(https_server.Start());
300
301 // Load a page with links that open in a new window.
302 // The links will point to the HTTPS server.
303 std::string replacement_path;
304 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
305 "files/click-noreferrer-links.html",
306 https_server.host_port_pair(),
307 &replacement_path));
308 ui_test_utils::NavigateToURL(browser(),
309 test_server()->GetURL(replacement_path));
310
311 // Get the original SiteInstance for later comparison.
312 scoped_refptr<SiteInstance> orig_site_instance(
313 browser()->GetSelectedTabContents()->GetSiteInstance());
314 EXPECT_TRUE(orig_site_instance != NULL);
315
316 // Load a cross-site page that fails with a 204 error.
317 ui_test_utils::NavigateToURL(browser(), https_server.GetURL("nocontent"));
318
319 // We should still be looking at the normal page.
320 scoped_refptr<SiteInstance> post_nav_site_instance(
321 browser()->GetSelectedTabContents()->GetSiteInstance());
322 EXPECT_EQ(orig_site_instance, post_nav_site_instance);
323 EXPECT_EQ("/files/click-noreferrer-links.html",
324 browser()->GetSelectedTabContents()->GetURL().path());
325
326 // Renderer-initiated navigations should work.
327 bool success = false;
328 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool(
329 browser()->GetSelectedTabContents()->render_view_host(), L"",
330 L"window.domAutomationController.send(clickNoRefLink());",
331 &success));
332 EXPECT_TRUE(success);
333
334 // Wait for the cross-site transition in the current tab to finish.
335 ui_test_utils::WaitForLoadStop(browser()->GetSelectedTabContents());
336
337 // Opens in same tab.
338 EXPECT_EQ(1, browser()->tab_count());
339 EXPECT_EQ(0, browser()->selected_index());
340 EXPECT_EQ("/files/title2.html",
341 browser()->GetSelectedTabContents()->GetURL().path());
342
343 // Should have the same SiteInstance.
344 scoped_refptr<SiteInstance> noref_site_instance(
345 browser()->GetSelectedTabContents()->GetSiteInstance());
346 EXPECT_EQ(orig_site_instance, noref_site_instance);
347 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host.cc ('k') | content/browser/renderer_host/resource_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698