| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 // Test that the app list will switch to the custom launcher page by sending a | 150 // Test that the app list will switch to the custom launcher page by sending a |
| 151 // click inside the clickzone, or a mouse scroll event. | 151 // click inside the clickzone, or a mouse scroll event. |
| 152 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, | 152 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, |
| 153 EventsActivateSwitchToCustomPage) { | 153 EventsActivateSwitchToCustomPage) { |
| 154 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); | 154 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); |
| 155 // Use an event generator to ensure targeting is correct. | 155 // Use an event generator to ensure targeting is correct. |
| 156 app_list::AppListView* app_list_view = GetAppListView(); | 156 app_list::AppListView* app_list_view = GetAppListView(); |
| 157 |
| 158 // On ChromeOS, displaying the app list can be delayed while icons finish |
| 159 // loading. Explicitly show it to ensure the event generator gets meaningful |
| 160 // coordinates. See http://crbug.com/525128. |
| 161 app_list_view->GetWidget()->Show(); |
| 162 |
| 157 app_list::ContentsView* contents_view = | 163 app_list::ContentsView* contents_view = |
| 158 app_list_view->app_list_main_view()->contents_view(); | 164 app_list_view->app_list_main_view()->contents_view(); |
| 159 gfx::NativeWindow window = app_list_view->GetWidget()->GetNativeWindow(); | 165 gfx::NativeWindow window = app_list_view->GetWidget()->GetNativeWindow(); |
| 160 ui::test::EventGenerator event_generator(window->GetRootWindow(), window); | 166 ui::test::EventGenerator event_generator(window->GetRootWindow(), window); |
| 161 EXPECT_TRUE( | 167 EXPECT_TRUE( |
| 162 contents_view->IsStateActive(app_list::AppListModel::STATE_START)); | 168 contents_view->IsStateActive(app_list::AppListModel::STATE_START)); |
| 163 | 169 |
| 164 // Find the clickzone. | 170 // Find the clickzone. |
| 165 gfx::Rect bounds = | 171 gfx::Rect bounds = |
| 166 contents_view->custom_page_view()->GetCollapsedLauncherPageBounds(); | 172 contents_view->custom_page_view()->GetCollapsedLauncherPageBounds(); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // And in reverse. | 454 // And in reverse. |
| 449 EXPECT_EQ( | 455 EXPECT_EQ( |
| 450 search_box_textfield, | 456 search_box_textfield, |
| 451 app_list_view->GetFocusManager()->GetNextFocusableView( | 457 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 452 custom_page_webview, custom_page_webview->GetWidget(), true, false)); | 458 custom_page_webview, custom_page_webview->GetWidget(), true, false)); |
| 453 EXPECT_EQ(custom_page_webview, | 459 EXPECT_EQ(custom_page_webview, |
| 454 app_list_view->GetFocusManager()->GetNextFocusableView( | 460 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 455 search_box_textfield, search_box_textfield->GetWidget(), true, | 461 search_box_textfield, search_box_textfield->GetWidget(), true, |
| 456 false)); | 462 false)); |
| 457 } | 463 } |
| OLD | NEW |