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

Side by Side Diff: chrome/browser/sessions/session_restore_browsertest.cc

Issue 1158523002: Add user_gesture param to BaseWindow::Show Base URL: https://chromium.googlesource.com/chromium/src.git@ug3_BaseWindow_Activate
Patch Set: Update callers Created 5 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <vector> 5 #include <vector>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/memory_pressure_listener.h" 9 #include "base/memory/memory_pressure_listener.h"
10 #include "base/process/launch.h" 10 #include "base/process/launch.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 // Turn on session restore. 429 // Turn on session restore.
430 SessionStartupPref::SetStartupPref( 430 SessionStartupPref::SetStartupPref(
431 browser()->profile(), 431 browser()->profile(),
432 SessionStartupPref(SessionStartupPref::LAST)); 432 SessionStartupPref(SessionStartupPref::LAST));
433 433
434 // Create a new popup. 434 // Create a new popup.
435 Profile* profile = browser()->profile(); 435 Profile* profile = browser()->profile();
436 Browser* popup = 436 Browser* popup =
437 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile, 437 new Browser(Browser::CreateParams(Browser::TYPE_POPUP, profile,
438 browser()->host_desktop_type())); 438 browser()->host_desktop_type()));
439 popup->window()->Show(); 439 popup->window()->Show(false /* user_gesture */);
440 440
441 // Close the browser. 441 // Close the browser.
442 CloseBrowserSynchronously(browser()); 442 CloseBrowserSynchronously(browser());
443 443
444 // Create a new window, which should trigger session restore. 444 // Create a new window, which should trigger session restore.
445 ui_test_utils::BrowserAddedObserver observer; 445 ui_test_utils::BrowserAddedObserver observer;
446 chrome::NewWindow(popup); 446 chrome::NewWindow(popup);
447 Browser* new_browser = observer.WaitForSingleNewBrowser(); 447 Browser* new_browser = observer.WaitForSingleNewBrowser();
448 448
449 ASSERT_TRUE(new_browser != NULL); 449 ASSERT_TRUE(new_browser != NULL);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 GURL url(ui_test_utils::GetTestUrl( 585 GURL url(ui_test_utils::GetTestUrl(
586 base::FilePath(base::FilePath::kCurrentDirectory), 586 base::FilePath(base::FilePath::kCurrentDirectory),
587 base::FilePath(FILE_PATH_LITERAL("title1.html")))); 587 base::FilePath(FILE_PATH_LITERAL("title1.html"))));
588 588
589 // Add a single tab. 589 // Add a single tab.
590 ui_test_utils::NavigateToURL(browser(), url); 590 ui_test_utils::NavigateToURL(browser(), url);
591 591
592 // Create a new incognito window. 592 // Create a new incognito window.
593 Browser* incognito_browser = CreateIncognitoBrowser(); 593 Browser* incognito_browser = CreateIncognitoBrowser();
594 chrome::AddTabAt(incognito_browser, GURL(), -1, true); 594 chrome::AddTabAt(incognito_browser, GURL(), -1, true);
595 incognito_browser->window()->Show(); 595 incognito_browser->window()->Show(false /* user_gesture */);
596 596
597 // Close the normal browser. After this we only have the incognito window 597 // Close the normal browser. After this we only have the incognito window
598 // open. 598 // open.
599 CloseBrowserSynchronously(browser()); 599 CloseBrowserSynchronously(browser());
600 600
601 // Create a new window, which should trigger session restore. 601 // Create a new window, which should trigger session restore.
602 ui_test_utils::BrowserAddedObserver browser_added_observer; 602 ui_test_utils::BrowserAddedObserver browser_added_observer;
603 chrome::NewWindow(incognito_browser); 603 chrome::NewWindow(incognito_browser);
604 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser(); 604 Browser* new_browser = browser_added_observer.WaitForSingleNewBrowser();
605 605
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 for (size_t i = 1; i < web_contents().size(); i++) { 1399 for (size_t i = 1; i < web_contents().size(); i++) {
1400 int current_rank = ranks[web_contents()[i]->GetLastCommittedURL()]; 1400 int current_rank = ranks[web_contents()[i]->GetLastCommittedURL()];
1401 int previous_rank = ranks[web_contents()[i - 1]->GetLastCommittedURL()]; 1401 int previous_rank = ranks[web_contents()[i - 1]->GetLastCommittedURL()];
1402 ASSERT_LT(previous_rank, current_rank); 1402 ASSERT_LT(previous_rank, current_rank);
1403 } 1403 }
1404 1404
1405 // The SessionWindow destructor deletes the tabs, so we have to clear them 1405 // The SessionWindow destructor deletes the tabs, so we have to clear them
1406 // here to avoid a crash. 1406 // here to avoid a crash.
1407 window.tabs.clear(); 1407 window.tabs.clear();
1408 } 1408 }
OLDNEW
« no previous file with comments | « chrome/browser/sessions/session_restore.cc ('k') | chrome/browser/ui/ash/chrome_new_window_delegate_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698