diff options
author | skuhne@google.com <skuhne@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 20:30:23 +0000 |
---|---|---|
committer | skuhne@google.com <skuhne@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 20:30:23 +0000 |
commit | bb98e82b6ab5971e892a61045fcfbc323e6bcab9 (patch) | |
tree | a2486b157d62281c40fad339116c7aa54ee53664 | |
parent | 9ba13733efa314d45cb7dba26cd035124f8007b5 (diff) | |
download | chromium_src-bb98e82b6ab5971e892a61045fcfbc323e6bcab9.zip chromium_src-bb98e82b6ab5971e892a61045fcfbc323e6bcab9.tar.gz chromium_src-bb98e82b6ab5971e892a61045fcfbc323e6bcab9.tar.bz2 |
Merge 198583 "Using constant iterator for Alt+1 switching instea..."
> Using constant iterator for Alt+1 switching instead of LRU iterator
>
> BUG=238370
> TEST=unit test
> R=jamescook@chromium.org
>
> Review URL: https://codereview.chromium.org/15010002
TBR=skuhne@google.com
Review URL: https://codereview.chromium.org/14744012
git-svn-id: svn://svn.chromium.org/chrome/branches/1500/src@198981 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc | 8 | ||||
-rw-r--r-- | chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc index c44eab4..1f4c843 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app.cc @@ -1678,11 +1678,13 @@ bool ChromeLauncherControllerPerApp::IsIncognito( void ChromeLauncherControllerPerApp::ActivateOrAdvanceToNextBrowser() { // Create a list of all suitable running browsers. std::vector<Browser*> items; + // We use the list in the order of how the browsers got created - not the LRU + // order. const BrowserList* ash_browser_list = BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); - for (BrowserList::const_reverse_iterator it = - ash_browser_list->begin_last_active(); - it != ash_browser_list->end_last_active(); ++it) { + for (BrowserList::const_iterator it = + ash_browser_list->begin(); + it != ash_browser_list->end(); ++it) { if (IsBrowserRepresentedInBrowserList(*it)) items.push_back(*it); } diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc index 7dc7409..9402c8f 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_browsertest.cc @@ -1307,6 +1307,25 @@ IN_PROC_BROWSER_TEST_F(LauncherPerAppAppBrowserTestNoDefaultBrowser, launcher_->ActivateLauncherItem(1); EXPECT_EQ(window2, ash::wm::GetActiveWindow()); + // Create a third browser - make sure that we do not toggle simply between + // two windows. + Browser* browser3 = CreateBrowser(profile()); + aura::Window* window3 = browser3->window()->GetNativeWindow(); + + EXPECT_EQ(3u, chrome::GetTotalBrowserCount()); + EXPECT_NE(window1, window3); + EXPECT_NE(window2, window3); + EXPECT_EQ(window3, ash::wm::GetActiveWindow()); + + launcher_->ActivateLauncherItem(1); + EXPECT_EQ(window1, ash::wm::GetActiveWindow()); + launcher_->ActivateLauncherItem(1); + EXPECT_EQ(window2, ash::wm::GetActiveWindow()); + launcher_->ActivateLauncherItem(1); + EXPECT_EQ(window3, ash::wm::GetActiveWindow()); + launcher_->ActivateLauncherItem(1); + EXPECT_EQ(window1, ash::wm::GetActiveWindow()); + // Create anther app and make sure that none of our browsers is active. LoadAndLaunchExtension("app1", extension_misc::LAUNCH_TAB, NEW_WINDOW); EXPECT_NE(window1, ash::wm::GetActiveWindow()); @@ -1314,5 +1333,5 @@ IN_PROC_BROWSER_TEST_F(LauncherPerAppAppBrowserTestNoDefaultBrowser, // After activation our browser should be active again. launcher_->ActivateLauncherItem(1); - EXPECT_EQ(window2, ash::wm::GetActiveWindow()); + EXPECT_EQ(window1, ash::wm::GetActiveWindow()); } |