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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 EXPECT_FALSE(custom_page_view->visible()); | 383 EXPECT_FALSE(custom_page_view->visible()); |
384 | 384 |
385 SetCustomLauncherPageEnabled(true); | 385 SetCustomLauncherPageEnabled(true); |
386 EXPECT_TRUE(model->custom_launcher_page_enabled()); | 386 EXPECT_TRUE(model->custom_launcher_page_enabled()); |
387 EXPECT_TRUE(custom_page_view->visible()); | 387 EXPECT_TRUE(custom_page_view->visible()); |
388 } | 388 } |
389 | 389 |
390 // Currently this is flaky. | 390 // Currently this is flaky. |
391 // Disabled test http://crbug.com/463456 | 391 // Disabled test http://crbug.com/463456 |
392 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, | 392 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, |
393 DISABLED_LauncherPageFocusTraversal) { | 393 LauncherPageFocusTraversal) { |
394 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); | 394 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); |
395 app_list::AppListView* app_list_view = GetAppListView(); | 395 app_list::AppListView* app_list_view = GetAppListView(); |
396 app_list::ContentsView* contents_view = | 396 app_list::ContentsView* contents_view = |
397 app_list_view->app_list_main_view()->contents_view(); | 397 app_list_view->app_list_main_view()->contents_view(); |
398 app_list::SearchBoxView* search_box_view = | 398 app_list::SearchBoxView* search_box_view = |
399 app_list_view->app_list_main_view()->search_box_view(); | 399 app_list_view->app_list_main_view()->search_box_view(); |
400 | 400 |
401 ASSERT_TRUE( | 401 ASSERT_TRUE( |
402 contents_view->IsStateActive(app_list::AppListModel::STATE_START)); | 402 contents_view->IsStateActive(app_list::AppListModel::STATE_START)); |
403 EXPECT_EQ(app_list_view->GetFocusManager()->GetFocusedView(), | |
404 search_box_view->search_box()); | |
405 | 403 |
406 { | 404 { |
407 ExtensionTestMessageListener listener("onPageProgressAt1", false); | 405 ExtensionTestMessageListener listener("onPageProgressAt1", false); |
408 contents_view->SetActiveState( | 406 contents_view->SetActiveState( |
409 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); | 407 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); |
410 listener.WaitUntilSatisfied(); | 408 listener.WaitUntilSatisfied(); |
411 EXPECT_TRUE(contents_view->IsStateActive( | |
412 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); | |
413 EXPECT_EQ(app_list_view->GetFocusManager()->GetFocusedView(), | |
414 search_box_view->search_box()); | |
415 } | 409 } |
416 { | 410 |
417 ExtensionTestMessageListener listener("textfieldFocused", false); | 411 // Expect that the search box and webview are the only two focusable views. |
418 app_list_view->GetFocusManager()->AdvanceFocus(false); | 412 views::View* search_box_textfield = search_box_view->search_box(); |
419 listener.WaitUntilSatisfied(); | 413 views::WebView* custom_page_webview = static_cast<views::WebView*>( |
420 EXPECT_NE(app_list_view->GetFocusManager()->GetFocusedView(), | 414 contents_view->custom_page_view()->custom_launcher_page_contents()); |
421 search_box_view->search_box()); | 415 EXPECT_EQ(custom_page_webview, |
422 } | 416 app_list_view->GetFocusManager()->GetNextFocusableView( |
423 { | 417 search_box_textfield, search_box_textfield->GetWidget(), false, |
424 ExtensionTestMessageListener listener("textfieldBlurred", false); | 418 false)); |
425 app_list_view->GetFocusManager()->AdvanceFocus(false); | 419 EXPECT_EQ( |
426 listener.WaitUntilSatisfied(); | 420 search_box_textfield, |
427 EXPECT_EQ(app_list_view->GetFocusManager()->GetFocusedView(), | 421 app_list_view->GetFocusManager()->GetNextFocusableView( |
428 search_box_view->search_box()); | 422 custom_page_webview, custom_page_webview->GetWidget(), false, false)); |
429 } | 423 |
| 424 // And in reverse. |
| 425 EXPECT_EQ( |
| 426 search_box_textfield, |
| 427 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 428 custom_page_webview, custom_page_webview->GetWidget(), true, false)); |
| 429 EXPECT_EQ(custom_page_webview, |
| 430 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 431 search_box_textfield, search_box_textfield->GetWidget(), true, |
| 432 false)); |
430 } | 433 } |
OLD | NEW |