| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "chrome/browser/tabs/tab_strip_model.h" | 14 #include "chrome/browser/tabs/tab_strip_model.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 18 #include "chrome/browser/ui/view_ids.h" | 18 #include "chrome/browser/ui/view_ids.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/url_constants.h" | 21 #include "chrome/common/url_constants.h" |
| 22 #include "chrome/test/base/in_process_browser_test.h" | 22 #include "chrome/test/base/in_process_browser_test.h" |
| 23 #include "chrome/test/base/ui_test_utils.h" | 23 #include "chrome/test/base/ui_test_utils.h" |
| 24 #include "content/browser/renderer_host/render_view_host.h" | 24 #include "content/browser/renderer_host/render_view_host.h" |
| 25 #include "content/browser/renderer_host/render_widget_host_view.h" | 25 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 26 #include "content/browser/tab_contents/interstitial_page.h" | 26 #include "content/browser/tab_contents/interstitial_page.h" |
| 27 #include "content/browser/tab_contents/tab_contents.h" | |
| 28 #include "content/browser/tab_contents/tab_contents_view.h" | 27 #include "content/browser/tab_contents/tab_contents_view.h" |
| 29 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
| 29 #include "content/public/browser/web_contents.h" |
| 30 #include "net/test/test_server.h" | 30 #include "net/test/test_server.h" |
| 31 | 31 |
| 32 #if defined(TOOLKIT_VIEWS) || defined(OS_WIN) | 32 #if defined(TOOLKIT_VIEWS) || defined(OS_WIN) |
| 33 #include "ui/views/focus/focus_manager.h" | 33 #include "ui/views/focus/focus_manager.h" |
| 34 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 #if defined(TOOLKIT_VIEWS) | 37 #if defined(TOOLKIT_VIEWS) |
| 38 #include "chrome/browser/ui/views/frame/browser_view.h" | 38 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 39 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 39 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 { false, true, false, true, false } | 291 { false, true, false, true, false } |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 for (int i = 1; i < 3; i++) { | 294 for (int i = 1; i < 3; i++) { |
| 295 for (int j = 0; j < 5; j++) { | 295 for (int j = 0; j < 5; j++) { |
| 296 // Activate the tab. | 296 // Activate the tab. |
| 297 browser()->ActivateTabAt(j, true); | 297 browser()->ActivateTabAt(j, true); |
| 298 | 298 |
| 299 // Activate the location bar or the page. | 299 // Activate the location bar or the page. |
| 300 if (kFocusPage[i][j]) { | 300 if (kFocusPage[i][j]) { |
| 301 browser()->GetTabContentsAt(j)->GetView()->Focus(); | 301 browser()->GetWebContentsAt(j)->GetView()->Focus(); |
| 302 } else { | 302 } else { |
| 303 browser()->FocusLocationBar(); | 303 browser()->FocusLocationBar(); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 | 306 |
| 307 // Now come back to the tab and check the right view is focused. | 307 // Now come back to the tab and check the right view is focused. |
| 308 for (int j = 0; j < 5; j++) { | 308 for (int j = 0; j < 5; j++) { |
| 309 // Activate the tab. | 309 // Activate the tab. |
| 310 browser()->ActivateTabAt(j, true); | 310 browser()->ActivateTabAt(j, true); |
| 311 | 311 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 browser()->Reload(CURRENT_TAB); | 898 browser()->Reload(CURRENT_TAB); |
| 899 observer.Wait(); | 899 observer.Wait(); |
| 900 } | 900 } |
| 901 | 901 |
| 902 // Focus should now be on the tab contents. | 902 // Focus should now be on the tab contents. |
| 903 browser()->ShowDownloadsTab(); | 903 browser()->ShowDownloadsTab(); |
| 904 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 904 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 905 } | 905 } |
| 906 | 906 |
| 907 } // namespace | 907 } // namespace |
| OLD | NEW |