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

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

Issue 334553002: Unflake PrerenderOmniboxBrowserTest.PrerenderOmniboxAbandon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4362 matching lines...) Expand 10 before | Expand all | Expand 10 after
4373 // Fake an omnibox prerender. 4373 // Fake an omnibox prerender.
4374 scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender( 4374 scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender(
4375 test_server()->GetURL("files/empty.html"), 4375 test_server()->GetURL("files/empty.html"),
4376 FINAL_STATUS_CANCELLED); 4376 FINAL_STATUS_CANCELLED);
4377 4377
4378 // Revert the location bar. This should cancel the prerender. 4378 // Revert the location bar. This should cancel the prerender.
4379 GetLocationBar()->Revert(); 4379 GetLocationBar()->Revert();
4380 prerender->WaitForStop(); 4380 prerender->WaitForStop();
4381 } 4381 }
4382 4382
4383 // Checks that closing the omnibox popup cancels an omnibox prerender. 4383 // Checks that accepting omnibox input abandons an omnibox prerender.
4384 // Disabled: flaky on all platforms. See http://crbug.com/368721. 4384 IN_PROC_BROWSER_TEST_F(PrerenderOmniboxBrowserTest, PrerenderOmniboxAbandon) {
4385 IN_PROC_BROWSER_TEST_F(PrerenderOmniboxBrowserTest,
4386 DISABLED_PrerenderOmniboxAbandon) {
4387 // Set the abandon timeout to something high so it does not introduce 4385 // Set the abandon timeout to something high so it does not introduce
4388 // flakiness if the prerender times out before the test completes. 4386 // flakiness if the prerender times out before the test completes.
4389 GetPrerenderManager()->mutable_config().abandon_time_to_live = 4387 GetPrerenderManager()->mutable_config().abandon_time_to_live =
4390 base::TimeDelta::FromDays(999); 4388 base::TimeDelta::FromDays(999);
4391 4389
4392 // Ensure the cookie store has been loaded. 4390 // Ensure the cookie store has been loaded.
4393 if (!GetPrerenderManager()->cookie_store_loaded()) { 4391 if (!GetPrerenderManager()->cookie_store_loaded()) {
4394 base::RunLoop loop; 4392 base::RunLoop loop;
4395 GetPrerenderManager()->set_on_cookie_store_loaded_cb_for_testing( 4393 GetPrerenderManager()->set_on_cookie_store_loaded_cb_for_testing(
4396 loop.QuitClosure()); 4394 loop.QuitClosure());
4397 loop.Run(); 4395 loop.Run();
4398 } 4396 }
4399 4397
4400 // Enter a URL into the Omnibox. 4398 // Enter a URL into the Omnibox.
4401 OmniboxView* omnibox_view = GetOmniboxView(); 4399 OmniboxView* omnibox_view = GetOmniboxView();
4402 omnibox_view->OnBeforePossibleChange(); 4400 omnibox_view->OnBeforePossibleChange();
4403 omnibox_view->SetUserText( 4401 omnibox_view->SetUserText(
4404 base::UTF8ToUTF16(test_server()->GetURL("files/empty.html?1").spec())); 4402 base::UTF8ToUTF16(test_server()->GetURL("files/empty.html?1").spec()));
4405 omnibox_view->OnAfterPossibleChange(); 4403 omnibox_view->OnAfterPossibleChange();
4406 WaitForAutocompleteDone(omnibox_view); 4404 WaitForAutocompleteDone(omnibox_view);
4407 4405
4408 // Fake an omnibox prerender for a different URL. 4406 // Fake an omnibox prerender for a different URL.
4409 scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender( 4407 scoped_ptr<TestPrerender> prerender = StartOmniboxPrerender(
4410 test_server()->GetURL("files/empty.html?2"), 4408 test_server()->GetURL("files/empty.html?2"),
4411 FINAL_STATUS_APP_TERMINATING); 4409 FINAL_STATUS_APP_TERMINATING);
4412 4410
4411 // The final status may be either FINAL_STATUS_APP_TERMINATING or
4412 // FINAL_STATUS_CANCELLED. Although closing the omnibox will not cancel an
4413 // abandoned prerender, the AutocompleteActionPredictor will cancel the
4414 // predictor on destruction.
4415 prerender->contents()->set_skip_final_checks(true);
4416
4413 // Navigate to the URL entered. 4417 // Navigate to the URL entered.
4414 omnibox_view->model()->AcceptInput(CURRENT_TAB, false); 4418 omnibox_view->model()->AcceptInput(CURRENT_TAB, false);
4415 4419
4416 // Prerender should be running, but abandoned. 4420 // Prerender should be running, but abandoned.
4417 EXPECT_TRUE( 4421 EXPECT_TRUE(
4418 GetAutocompleteActionPredictor()->IsPrerenderAbandonedForTesting()); 4422 GetAutocompleteActionPredictor()->IsPrerenderAbandonedForTesting());
4419 } 4423 }
4420 4424
4421 } // namespace prerender 4425 } // namespace prerender
OLDNEW
« 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