| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "ui/base/hit_test.h" | 9 #include "ui/base/hit_test.h" |
| 10 #include "ui/events/event_processor.h" | 10 #include "ui/events/event_processor.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 { border + 10, HTSYSMENU }, | 183 { border + 10, HTSYSMENU }, |
| 184 { border + 20, HTCLIENT }, | 184 { border + 20, HTCLIENT }, |
| 185 { border + 50, HTCLIENT }, | 185 { border + 50, HTCLIENT }, |
| 186 { border + 60, HTCLIENT }, | 186 { border + 60, HTCLIENT }, |
| 187 { 1000, HTNOWHERE }, | 187 { 1000, HTNOWHERE }, |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 for (size_t i = 0; i < arraysize(cases); ++i) { | 190 for (size_t i = 0; i < arraysize(cases); ++i) { |
| 191 gfx::Point point(cases[i].point, cases[i].point); | 191 gfx::Point point(cases[i].point, cases[i].point); |
| 192 EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point)) | 192 EXPECT_EQ(cases[i].hit, frame->NonClientHitTest(point)) |
| 193 << " with border: " << border << ", at point " << cases[i].point; | 193 << " case " << i << " with border: " << border << ", at point " |
| 194 << cases[i].point; |
| 194 } | 195 } |
| 195 } | 196 } |
| 196 | 197 |
| 197 TEST_F(DialogTest, HitTest_WithTitle) { | 198 TEST_F(DialogTest, HitTest_WithTitle) { |
| 198 // Ensure that BubbleFrameView hit-tests as expected when the title is shown. | 199 // Ensure that BubbleFrameView hit-tests as expected when the title is shown. |
| 199 const NonClientView* view = dialog()->GetWidget()->non_client_view(); | 200 const NonClientView* view = dialog()->GetWidget()->non_client_view(); |
| 200 dialog()->set_title(base::ASCIIToUTF16("Title")); | 201 dialog()->set_title(base::ASCIIToUTF16("Title")); |
| 201 dialog()->GetWidget()->UpdateWindowTitle(); | 202 dialog()->GetWidget()->UpdateWindowTitle(); |
| 202 BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view()); | 203 BubbleFrameView* frame = static_cast<BubbleFrameView*>(view->frame_view()); |
| 203 const int border = frame->bubble_border()->GetBorderThickness(); | 204 const int border = frame->bubble_border()->GetBorderThickness(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 dialog2->TearDown(); | 242 dialog2->TearDown(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 // Tests default focus is assigned correctly when showing a new dialog. | 245 // Tests default focus is assigned correctly when showing a new dialog. |
| 245 TEST_F(DialogTest, InitialFocus) { | 246 TEST_F(DialogTest, InitialFocus) { |
| 246 EXPECT_TRUE(dialog()->input()->HasFocus()); | 247 EXPECT_TRUE(dialog()->input()->HasFocus()); |
| 247 EXPECT_EQ(dialog()->input(), dialog()->GetFocusManager()->GetFocusedView()); | 248 EXPECT_EQ(dialog()->input(), dialog()->GetFocusManager()->GetFocusedView()); |
| 248 } | 249 } |
| 249 | 250 |
| 250 } // namespace views | 251 } // namespace views |
| OLD | NEW |