OLD | NEW |
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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 #include "chrome/grit/chromium_strings.h" | 66 #include "chrome/grit/chromium_strings.h" |
67 #include "chrome/grit/generated_resources.h" | 67 #include "chrome/grit/generated_resources.h" |
68 #include "chrome/test/base/in_process_browser_test.h" | 68 #include "chrome/test/base/in_process_browser_test.h" |
69 #include "chrome/test/base/test_switches.h" | 69 #include "chrome/test/base/test_switches.h" |
70 #include "chrome/test/base/ui_test_utils.h" | 70 #include "chrome/test/base/ui_test_utils.h" |
71 #include "components/app_modal/app_modal_dialog.h" | 71 #include "components/app_modal/app_modal_dialog.h" |
72 #include "components/app_modal/app_modal_dialog_queue.h" | 72 #include "components/app_modal/app_modal_dialog_queue.h" |
73 #include "components/app_modal/javascript_app_modal_dialog.h" | 73 #include "components/app_modal/javascript_app_modal_dialog.h" |
74 #include "components/app_modal/native_app_modal_dialog.h" | 74 #include "components/app_modal/native_app_modal_dialog.h" |
75 #include "components/content_settings/core/browser/host_content_settings_map.h" | 75 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 76 #include "components/omnibox/browser/omnibox_view.h" |
76 #include "components/sessions/core/base_session_service_test_helper.h" | 77 #include "components/sessions/core/base_session_service_test_helper.h" |
77 #include "components/translate/core/browser/language_state.h" | 78 #include "components/translate/core/browser/language_state.h" |
78 #include "components/translate/core/common/language_detection_details.h" | 79 #include "components/translate/core/common/language_detection_details.h" |
79 #include "content/public/browser/favicon_status.h" | 80 #include "content/public/browser/favicon_status.h" |
80 #include "content/public/browser/host_zoom_map.h" | 81 #include "content/public/browser/host_zoom_map.h" |
81 #include "content/public/browser/interstitial_page.h" | 82 #include "content/public/browser/interstitial_page.h" |
82 #include "content/public/browser/interstitial_page_delegate.h" | 83 #include "content/public/browser/interstitial_page_delegate.h" |
83 #include "content/public/browser/navigation_entry.h" | 84 #include "content/public/browser/navigation_entry.h" |
84 #include "content/public/browser/notification_service.h" | 85 #include "content/public/browser/notification_service.h" |
85 #include "content/public/browser/render_frame_host.h" | 86 #include "content/public/browser/render_frame_host.h" |
(...skipping 2779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2866 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2866 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2867 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2867 gfx::Size exp_final_size(initial_wcv_size); | 2868 gfx::Size exp_final_size(initial_wcv_size); |
2868 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2869 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2869 wcv_resize_insets.height() + height_inset); | 2870 wcv_resize_insets.height() + height_inset); |
2870 EXPECT_EQ(exp_final_size, | 2871 EXPECT_EQ(exp_final_size, |
2871 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2872 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2872 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2873 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2873 } | 2874 } |
2874 | 2875 |
| 2876 // Opening a new tab and then closing it should return focus to the previous |
| 2877 // tab. |
| 2878 // Regression test for http://crbug.com/582249 |
| 2879 IN_PROC_BROWSER_TEST_F(BrowserTest, CloseTabFocus) { |
| 2880 chrome::NewTab(browser()); |
| 2881 chrome::NewTab(browser()); |
| 2882 chrome::NewTab(browser()); |
| 2883 EXPECT_EQ(3, browser()->tab_strip_model()->active_index()); |
| 2884 |
| 2885 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 2886 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 2887 |
| 2888 chrome::NewTab(browser()); |
| 2889 EXPECT_EQ(4, browser()->tab_strip_model()->active_index()); |
| 2890 |
| 2891 chrome::CloseTab(browser()); |
| 2892 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); |
| 2893 |
| 2894 // Check opening a new tab via Alt+Enter in the omnibox. |
| 2895 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 2896 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 2897 |
| 2898 browser()->GetOmniboxView()->SetUserText( |
| 2899 ASCIIToUTF16("http://www.google.com")); |
| 2900 browser()->GetOmniboxView()->model()->AcceptInput(NEW_FOREGROUND_TAB, false); |
| 2901 EXPECT_EQ(4, browser()->tab_strip_model()->active_index()); |
| 2902 |
| 2903 chrome::CloseTab(browser()); |
| 2904 EXPECT_EQ(1, browser()->tab_strip_model()->active_index()); |
| 2905 } |
| 2906 |
2875 IN_PROC_BROWSER_TEST_F(BrowserTest, CanDuplicateTab) { | 2907 IN_PROC_BROWSER_TEST_F(BrowserTest, CanDuplicateTab) { |
2876 GURL url(ui_test_utils::GetTestUrl( | 2908 GURL url(ui_test_utils::GetTestUrl( |
2877 base::FilePath(base::FilePath::kCurrentDirectory), | 2909 base::FilePath(base::FilePath::kCurrentDirectory), |
2878 base::FilePath(kTitle1File))); | 2910 base::FilePath(kTitle1File))); |
2879 ui_test_utils::NavigateToURL(browser(), url); | 2911 ui_test_utils::NavigateToURL(browser(), url); |
2880 | 2912 |
2881 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); | 2913 AddTabAtIndex(0, url, ui::PAGE_TRANSITION_TYPED); |
2882 | 2914 |
2883 int active_index = browser()->tab_strip_model()->active_index(); | 2915 int active_index = browser()->tab_strip_model()->active_index(); |
2884 EXPECT_EQ(0, active_index); | 2916 EXPECT_EQ(0, active_index); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3314 Browser* browser = new Browser(params); | 3346 Browser* browser = new Browser(params); |
3315 gfx::Rect bounds = browser->window()->GetBounds(); | 3347 gfx::Rect bounds = browser->window()->GetBounds(); |
3316 | 3348 |
3317 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 3349 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
3318 // See https://crbug.com/567925. | 3350 // See https://crbug.com/567925. |
3319 EXPECT_GE(bounds.width(), 100); | 3351 EXPECT_GE(bounds.width(), 100); |
3320 EXPECT_EQ(122, bounds.height()); | 3352 EXPECT_EQ(122, bounds.height()); |
3321 browser->window()->Close(); | 3353 browser->window()->Close(); |
3322 } | 3354 } |
3323 } | 3355 } |
OLD | NEW |