Chromium Code Reviews| 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 2544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2555 // Shift-middle-clicks open in a foreground tab. | 2555 // Shift-middle-clicks open in a foreground tab. |
| 2556 // http://crbug.com/396347 | 2556 // http://crbug.com/396347 |
| 2557 IN_PROC_BROWSER_TEST_F(ClickModifierTest, DISABLED_HrefShiftMiddleClickTest) { | 2557 IN_PROC_BROWSER_TEST_F(ClickModifierTest, DISABLED_HrefShiftMiddleClickTest) { |
| 2558 int modifiers = blink::WebInputEvent::ShiftKey; | 2558 int modifiers = blink::WebInputEvent::ShiftKey; |
| 2559 blink::WebMouseEvent::Button button = blink::WebMouseEvent::Button::Middle; | 2559 blink::WebMouseEvent::Button button = blink::WebMouseEvent::Button::Middle; |
| 2560 WindowOpenDisposition disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; | 2560 WindowOpenDisposition disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 2561 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); | 2561 RunTest(browser(), GetHrefURL(), modifiers, button, disposition); |
| 2562 } | 2562 } |
| 2563 | 2563 |
| 2564 IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { | 2564 IN_PROC_BROWSER_TEST_F(BrowserTest, GetSizeForNewRenderView) { |
| 2565 // Force an initial resize. This works around a test-only problem on Chrome OS | |
| 2566 // where the shelf may not be created before the initial test browser window | |
| 2567 // opens, which leads to sizing issues in WebContents resize. | |
| 2568 browser()->window()->SetBounds(gfx::Rect(10, 20, 600, 400)); | |
| 2569 // Let the message loop run so that resize actually takes effect. | |
| 2570 content::RunAllPendingInMessageLoop(); | |
| 2571 | |
| 2565 // The instant extended NTP has javascript that does not work with | 2572 // The instant extended NTP has javascript that does not work with |
| 2566 // ui_test_utils::NavigateToURL. The NTP rvh reloads when the browser tries | 2573 // ui_test_utils::NavigateToURL. The NTP rvh reloads when the browser tries |
| 2567 // to navigate away from the page, which causes the WebContents to end up in | 2574 // to navigate away from the page, which causes the WebContents to end up in |
| 2568 // an inconsistent state. (is_loaded = true, last_commited_url=ntp, | 2575 // an inconsistent state. (is_loaded = true, last_commited_url=ntp, |
| 2569 // visible_url=title1.html) | 2576 // visible_url=title1.html) |
| 2570 browser()->profile()->GetPrefs()->SetBoolean(prefs::kWebKitJavascriptEnabled, | 2577 browser()->profile()->GetPrefs()->SetBoolean(prefs::kWebKitJavascriptEnabled, |
| 2571 false); | 2578 false); |
| 2572 ASSERT_TRUE(embedded_test_server()->Start()); | 2579 ASSERT_TRUE(embedded_test_server()->Start()); |
| 2573 // Create an HTTPS server for cross-site transition. | 2580 // Create an HTTPS server for cross-site transition. |
| 2574 net::EmbeddedTestServer https_test_server( | 2581 net::EmbeddedTestServer https_test_server( |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2649 observer.set_wcv_resize_insets(wcv_resize_insets); | 2656 observer.set_wcv_resize_insets(wcv_resize_insets); |
| 2650 ui_test_utils::NavigateToURL(browser(), | 2657 ui_test_utils::NavigateToURL(browser(), |
| 2651 embedded_test_server()->GetURL("/title2.html")); | 2658 embedded_test_server()->GetURL("/title2.html")); |
| 2652 ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); | 2659 ASSERT_EQ(BookmarkBar::HIDDEN, browser()->bookmark_bar_state()); |
| 2653 gfx::Size rwhv_create_size2, rwhv_commit_size2, wcv_commit_size2; | 2660 gfx::Size rwhv_create_size2, rwhv_commit_size2, wcv_commit_size2; |
| 2654 observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(), | 2661 observer.GetSizeForRenderViewHost(web_contents->GetRenderViewHost(), |
| 2655 &rwhv_create_size2, | 2662 &rwhv_create_size2, |
| 2656 &rwhv_commit_size2, | 2663 &rwhv_commit_size2, |
| 2657 &wcv_commit_size2); | 2664 &wcv_commit_size2); |
| 2658 | 2665 |
| 2659 // The behavior on OSX and Views is incorrect in this edge case, but they are | 2666 // The behavior on OSX and Views is incorrect in this edge case, but they are |
|
James Cook
2017/01/11 00:39:50
msw, I ended up not deleting this code. Maybe it p
| |
| 2660 // differently incorrect. | 2667 // differently incorrect. |
| 2661 // The behavior should be: | 2668 // The behavior should be: |
| 2662 // initial wcv size: (100,100) (to choose random numbers) | 2669 // initial wcv size: (100,100) (to choose random numbers) |
| 2663 // initial rwhv size: (100,140) | 2670 // initial rwhv size: (100,140) |
| 2664 // commit wcv size: (101, 101) | 2671 // commit wcv size: (101, 101) |
| 2665 // commit rwhv size: (101, 141) | 2672 // commit rwhv size: (101, 141) |
| 2666 // final wcv size: (101, 141) | 2673 // final wcv size: (101, 141) |
| 2667 // final rwhv size: (101, 141) | 2674 // final rwhv size: (101, 141) |
| 2668 // | 2675 // |
| 2669 // On OSX, the commit rwhv size is (101, 101) | 2676 // On OSX, the commit rwhv size is (101, 101) |
| 2670 // On views, the commit wcv size is (101, 141) | 2677 // On views, the commit wcv size is (101, 141) |
| 2671 // All other sizes are correct. | 2678 // All other sizes are correct. |
| 2672 | 2679 |
| 2673 // The create height of RenderWidgetHostView should include the height inset. | 2680 // The create height of RenderWidgetHostView should include the height inset. |
| 2674 EXPECT_EQ(gfx::Size(initial_wcv_size.width(), | 2681 EXPECT_EQ(gfx::Size(initial_wcv_size.width(), |
| 2675 initial_wcv_size.height() + height_inset), | 2682 initial_wcv_size.height() + height_inset), |
| 2676 rwhv_create_size2); | 2683 rwhv_create_size2); |
| 2677 gfx::Size exp_commit_size(initial_wcv_size); | 2684 gfx::Size exp_commit_size(initial_wcv_size); |
| 2678 | 2685 |
| 2679 #if defined(OS_MACOSX) | 2686 #if defined(OS_MACOSX) |
| 2680 exp_commit_size.Enlarge(wcv_resize_insets.width(), | 2687 exp_commit_size.Enlarge(wcv_resize_insets.width(), |
| 2681 wcv_resize_insets.height()); | 2688 wcv_resize_insets.height()); |
| 2682 #else | 2689 #else |
| 2683 exp_commit_size.Enlarge(wcv_resize_insets.width(), | 2690 exp_commit_size.Enlarge(wcv_resize_insets.width(), |
| 2684 wcv_resize_insets.height() + height_inset); | 2691 wcv_resize_insets.height() + height_inset); |
| 2685 #endif | 2692 #endif |
| 2686 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2693 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
| 2687 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2694 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
| 2695 | |
| 2688 gfx::Size exp_final_size(initial_wcv_size); | 2696 gfx::Size exp_final_size(initial_wcv_size); |
| 2689 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2697 exp_final_size.Enlarge(wcv_resize_insets.width(), |
| 2690 wcv_resize_insets.height() + height_inset); | 2698 wcv_resize_insets.height() + height_inset); |
| 2691 EXPECT_EQ(exp_final_size, | 2699 EXPECT_EQ(exp_final_size, |
| 2692 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2700 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
| 2693 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2701 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
| 2694 } | 2702 } |
| 2695 | 2703 |
| 2696 IN_PROC_BROWSER_TEST_F(BrowserTest, CanDuplicateTab) { | 2704 IN_PROC_BROWSER_TEST_F(BrowserTest, CanDuplicateTab) { |
| 2697 GURL url(ui_test_utils::GetTestUrl( | 2705 GURL url(ui_test_utils::GetTestUrl( |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2881 Browser* browser = new Browser(params); | 2889 Browser* browser = new Browser(params); |
| 2882 gfx::Rect bounds = browser->window()->GetBounds(); | 2890 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2883 | 2891 |
| 2884 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2892 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2885 // See https://crbug.com/567925. | 2893 // See https://crbug.com/567925. |
| 2886 EXPECT_GE(bounds.width(), 100); | 2894 EXPECT_GE(bounds.width(), 100); |
| 2887 EXPECT_EQ(122, bounds.height()); | 2895 EXPECT_EQ(122, bounds.height()); |
| 2888 browser->window()->Close(); | 2896 browser->window()->Close(); |
| 2889 } | 2897 } |
| 2890 } | 2898 } |
| OLD | NEW |