| 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..7714f626e6cf3490905be2e01747006ea8e9b274 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.
|
| + 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)));
|
| +}
|
|
|