Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc |
| index 13796a0c7e81a9b48a9bdba2b842a4ecb595995c..765a4e792b46e6fa15e1233ebc7a8ac8da4be3c7 100644 |
| --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc |
| +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_unittest.cc |
| @@ -7,13 +7,14 @@ |
| #include "base/command_line.h" |
| #include "chrome/browser/ui/views/frame/browser_view.h" |
| #include "chrome/browser/ui/views/frame/test_with_browser_view.h" |
| +#include "chrome/browser/ui/views/tabs/tab_strip.h" |
| #include "ui/base/ui_base_switches.h" |
| #include "url/gurl.h" |
| class BrowserNonClientFrameViewTest : public TestWithBrowserView { |
| public: |
| - BrowserNonClientFrameViewTest() |
| - : TestWithBrowserView(Browser::TYPE_POPUP, false), frame_view_(nullptr) {} |
| + explicit BrowserNonClientFrameViewTest(Browser::Type type) |
| + : TestWithBrowserView(type, false), frame_view_(nullptr) {} |
| // TestWithBrowserView override: |
| void SetUp() override { |
| @@ -36,7 +37,14 @@ class BrowserNonClientFrameViewTest : public TestWithBrowserView { |
| DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewTest); |
| }; |
| -TEST_F(BrowserNonClientFrameViewTest, HitTestTopChrome) { |
| +class BrowserNonClientFrameViewPopupTest |
| + : public BrowserNonClientFrameViewTest { |
| + public: |
| + BrowserNonClientFrameViewPopupTest() |
| + : BrowserNonClientFrameViewTest(Browser::TYPE_POPUP) {} |
| +}; |
| + |
| +TEST_F(BrowserNonClientFrameViewPopupTest, HitTestPopupTopChrome) { |
| EXPECT_FALSE(frame_view_->HitTestRect(gfx::Rect(-1, 4, 1, 1))); |
| EXPECT_FALSE(frame_view_->HitTestRect(gfx::Rect(4, -1, 1, 1))); |
| const int top_inset = frame_view_->GetTopInset(false); |
| @@ -44,3 +52,30 @@ TEST_F(BrowserNonClientFrameViewTest, HitTestTopChrome) { |
| if (top_inset > 0) |
| EXPECT_TRUE(frame_view_->HitTestRect(gfx::Rect(4, top_inset - 1, 1, 1))); |
| } |
| + |
| +class BrowserNonClientFrameViewTabbedTest |
| + : public BrowserNonClientFrameViewTest { |
| + public: |
| + BrowserNonClientFrameViewTabbedTest() |
| + : BrowserNonClientFrameViewTest(Browser::TYPE_TABBED) {} |
| +}; |
| + |
| +TEST_F(BrowserNonClientFrameViewTabbedTest, HitTestTabstrip) { |
| + gfx::Rect tabstrip_bounds = |
| + frame_view_->browser_view()->tabstrip()->GetLocalBounds(); |
| + EXPECT_FALSE(tabstrip_bounds.IsEmpty()); |
| + |
| + // completely outside bounds |
|
Peter Kasting
2017/03/29 01:33:51
Nit: Capitals/periods
Bret
2017/03/29 19:12:50
Done.
|
| + EXPECT_FALSE(frame_view_->HitTestRect( |
| + gfx::Rect(tabstrip_bounds.x() - 1, tabstrip_bounds.y() + 1, 1, 1))); |
| + EXPECT_FALSE(frame_view_->HitTestRect( |
| + gfx::Rect(tabstrip_bounds.x() + 1, tabstrip_bounds.y() - 1, 1, 1))); |
| + |
| + // hits tab strip but not client area |
| + EXPECT_TRUE(frame_view_->HitTestRect( |
| + gfx::Rect(tabstrip_bounds.x() + 1, tabstrip_bounds.bottom() - 1, 1, 1))); |
| + |
| + // hits tab strip and client area |
| + EXPECT_TRUE(frame_view_->HitTestRect(gfx::Rect( |
| + tabstrip_bounds.x() + 1, tabstrip_bounds.bottom() - 1, 100, 100))); |
| +} |