Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: chrome/browser/ui/panels/panel_drag_browsertest.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_drag_browsertest.cc
diff --git a/chrome/browser/ui/panels/panel_drag_browsertest.cc b/chrome/browser/ui/panels/panel_drag_browsertest.cc
index 6bc24c5a07e51f5d1c7dbbe36d3577e1bb5470f3..e053aebdd839af43aef74ebe4c482d8263c2af09 100644
--- a/chrome/browser/ui/panels/panel_drag_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_drag_browsertest.cc
@@ -35,7 +35,7 @@ class PanelDragBrowserTest : public BasePanelBrowserTest {
}
// Drag |panel| from its origin by the offset |delta|.
- void DragPanelByDelta(Panel* panel, const gfx::Point& delta) {
+ void DragPanelByDelta(Panel* panel, const gfx::Vector2d& delta) {
scoped_ptr<NativePanelTesting> panel_testing(
CreateNativePanelTesting(panel));
gfx::Point mouse_location(panel->GetBounds().origin());
@@ -55,30 +55,30 @@ class PanelDragBrowserTest : public BasePanelBrowserTest {
panel_testing->FinishDragTitlebar();
}
- static gfx::Point GetDragDeltaToRemainDocked() {
- return gfx::Point(
+ static gfx::Vector2d GetDragDeltaToRemainDocked() {
+ return gfx::Vector2d(
-5,
-(PanelDragController::GetDetachDockedPanelThreshold() / 2));
}
- static gfx::Point GetDragDeltaToDetach() {
- return gfx::Point(
+ static gfx::Vector2d GetDragDeltaToDetach() {
+ return gfx::Vector2d(
-20,
-(PanelDragController::GetDetachDockedPanelThreshold() + 20));
}
- static gfx::Point GetDragDeltaToRemainDetached(Panel* panel) {
+ static gfx::Vector2d GetDragDeltaToRemainDetached(Panel* panel) {
int distance = panel->manager()->docked_strip()->display_area().bottom() -
panel->GetBounds().bottom();
- return gfx::Point(
+ return gfx::Vector2d(
-5,
distance - PanelDragController::GetDockDetachedPanelThreshold() * 2);
}
- static gfx::Point GetDragDeltaToAttach(Panel* panel) {
+ static gfx::Vector2d GetDragDeltaToAttach(Panel* panel) {
int distance = panel->manager()->docked_strip()->display_area().bottom() -
panel->GetBounds().bottom();
- return gfx::Point(
+ return gfx::Vector2d(
-20,
distance - PanelDragController::GetDockDetachedPanelThreshold() / 2);
}
@@ -177,7 +177,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragOneDockedPanel) {
}
IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) {
- static const gfx::Point small_delta(10, 0);
+ static const gfx::Vector2d small_delta(10, 0);
Panel* panel1 = CreateDockedPanel("1", gfx::Rect(0, 0, 100, 100));
Panel* panel2 = CreateDockedPanel("2", gfx::Rect(0, 0, 100, 100));
@@ -211,7 +211,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) {
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position2, panel2->GetBounds().origin());
- mouse_location = position2.Add(gfx::Point(1, 0));
+ mouse_location = position2.Add(gfx::Vector2d(1, 0));
panel1_testing->DragTitlebar(mouse_location);
EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
EXPECT_EQ(position1, panel2->GetBounds().origin());
@@ -243,7 +243,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) {
EXPECT_EQ(position2, panel1->GetBounds().origin());
EXPECT_EQ(position1, panel2->GetBounds().origin());
- mouse_location = position1.Add(gfx::Point(1, 0));
+ mouse_location = position1.Add(gfx::Vector2d(1, 0));
panel1_testing->DragTitlebar(mouse_location);
EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
EXPECT_EQ(position2, panel2->GetBounds().origin());
@@ -260,7 +260,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragTwoDockedPanels) {
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position2, panel2->GetBounds().origin());
- mouse_location = position2.Add(gfx::Point(1, 0));
+ mouse_location = position2.Add(gfx::Vector2d(1, 0));
panel1_testing->DragTitlebar(mouse_location);
EXPECT_EQ(mouse_location, panel1->GetBounds().origin());
EXPECT_EQ(position1, panel2->GetBounds().origin());
@@ -294,13 +294,13 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) {
EXPECT_EQ(position2, panel2->GetBounds().origin());
EXPECT_EQ(position3, panel3->GetBounds().origin());
- mouse_location = position2.Add(gfx::Point(1, 0));
+ mouse_location = position2.Add(gfx::Vector2d(1, 0));
panel3_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position3, panel2->GetBounds().origin());
EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
- mouse_location = position1.Add(gfx::Point(1, 0));
+ mouse_location = position1.Add(gfx::Vector2d(1, 0));
panel3_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position2, panel1->GetBounds().origin());
EXPECT_EQ(position3, panel2->GetBounds().origin());
@@ -323,13 +323,13 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) {
EXPECT_EQ(position3, panel2->GetBounds().origin());
EXPECT_EQ(position1, panel3->GetBounds().origin());
- mouse_location = position2.Add(gfx::Point(1, 0));
+ mouse_location = position2.Add(gfx::Vector2d(1, 0));
panel3_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position3, panel2->GetBounds().origin());
EXPECT_EQ(mouse_location, panel3->GetBounds().origin());
- mouse_location = position3.Add(gfx::Point(1, 0));
+ mouse_location = position3.Add(gfx::Vector2d(1, 0));
panel3_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position2, panel2->GetBounds().origin());
@@ -349,7 +349,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) {
EXPECT_EQ(position3, panel2->GetBounds().origin());
EXPECT_EQ(position1, panel3->GetBounds().origin());
- mouse_location = position1.Add(gfx::Point(1, 0));
+ mouse_location = position1.Add(gfx::Vector2d(1, 0));
panel2_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position3, panel1->GetBounds().origin());
EXPECT_EQ(mouse_location, panel2->GetBounds().origin());
@@ -369,7 +369,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) {
EXPECT_EQ(position1, panel2->GetBounds().origin());
EXPECT_EQ(position2, panel3->GetBounds().origin());
- mouse_location = position3.Add(gfx::Point(1, 0));
+ mouse_location = position3.Add(gfx::Vector2d(1, 0));
panel2_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position2, panel1->GetBounds().origin());
EXPECT_EQ(mouse_location, panel2->GetBounds().origin());
@@ -391,7 +391,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DragThreeDockedPanels) {
EXPECT_EQ(position3, panel2->GetBounds().origin());
EXPECT_EQ(position1, panel3->GetBounds().origin());
- mouse_location = position3.Add(gfx::Point(1, 0));
+ mouse_location = position3.Add(gfx::Vector2d(1, 0));
panel3_testing->DragTitlebar(mouse_location);
EXPECT_EQ(position1, panel1->GetBounds().origin());
EXPECT_EQ(position2, panel2->GetBounds().origin());
@@ -862,7 +862,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, Detach) {
// Drag up the panel in a small offset that does not trigger the detach.
// Expect that the panel is still docked and only x coordinate of its position
// is changed.
- gfx::Point drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
+ gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
mouse_location = mouse_location.Add(drag_delta_to_remain_docked);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(1, docked_strip->num_panels());
@@ -874,7 +874,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, Detach) {
// Continue dragging up the panel in big offset that triggers the detach.
// Expect that the panel is previewed as detached.
- gfx::Point drag_delta_to_detach = GetDragDeltaToDetach();
+ gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
mouse_location = mouse_location.Add(drag_delta_to_detach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(0, docked_strip->num_panels());
@@ -917,7 +917,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachAndCancel) {
// Drag up the panel in a small offset that does not trigger the detach.
// Expect that the panel is still docked and only x coordinate of its position
// is changed.
- gfx::Point drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
+ gfx::Vector2d drag_delta_to_remain_docked = GetDragDeltaToRemainDocked();
mouse_location = mouse_location.Add(drag_delta_to_remain_docked);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(1, docked_strip->num_panels());
@@ -929,7 +929,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachAndCancel) {
// Continue dragging up the panel in big offset that triggers the detach.
// Expect that the panel is previewed as detached.
- gfx::Point drag_delta_to_detach = GetDragDeltaToDetach();
+ gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
mouse_location = mouse_location.Add(drag_delta_to_detach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(0, docked_strip->num_panels());
@@ -972,7 +972,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, Attach) {
// Drag down the panel but not close enough to the bottom of work area.
// Expect that the panel is still detached.
- gfx::Point drag_delta_to_remain_detached =
+ gfx::Vector2d drag_delta_to_remain_detached =
GetDragDeltaToRemainDetached(panel);
mouse_location = mouse_location.Add(drag_delta_to_remain_detached);
panel_testing->DragTitlebar(mouse_location);
@@ -986,7 +986,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, Attach) {
// Continue dragging down the panel to make it close enough to the bottom of
// work area.
// Expect that the panel is previewed as docked.
- gfx::Point drag_delta_to_attach = GetDragDeltaToAttach(panel);
+ gfx::Vector2d drag_delta_to_attach = GetDragDeltaToAttach(panel);
mouse_location = mouse_location.Add(drag_delta_to_attach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(1, docked_strip->num_panels());
@@ -1031,7 +1031,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, AttachAndCancel) {
// Drag down the panel but not close enough to the bottom of work area.
// Expect that the panel is still detached.
- gfx::Point drag_delta_to_remain_detached =
+ gfx::Vector2d drag_delta_to_remain_detached =
GetDragDeltaToRemainDetached(panel);
mouse_location = mouse_location.Add(drag_delta_to_remain_detached);
panel_testing->DragTitlebar(mouse_location);
@@ -1045,7 +1045,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, AttachAndCancel) {
// Continue dragging down the panel to make it close enough to the bottom of
// work area.
// Expect that the panel is previewed as docked.
- gfx::Point drag_delta_to_attach = GetDragDeltaToAttach(panel);
+ gfx::Vector2d drag_delta_to_attach = GetDragDeltaToAttach(panel);
mouse_location = mouse_location.Add(drag_delta_to_attach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(1, docked_strip->num_panels());
@@ -1085,7 +1085,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachAttachAndCancel) {
// Drag up the panel to trigger the detach.
// Expect that the panel is previewed as detached.
- gfx::Point drag_delta_to_detach = GetDragDeltaToDetach();
+ gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
mouse_location = mouse_location.Add(drag_delta_to_detach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(0, docked_strip->num_panels());
@@ -1096,7 +1096,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachAttachAndCancel) {
EXPECT_EQ(panel_new_bounds, panel->GetBounds());
// Continue dragging down the panel to trigger the re-attach.
- gfx::Point drag_delta_to_reattach = GetDragDeltaToAttach(panel);
+ gfx::Vector2d drag_delta_to_reattach = GetDragDeltaToAttach(panel);
mouse_location = mouse_location.Add(drag_delta_to_reattach);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(1, docked_strip->num_panels());
@@ -1106,7 +1106,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachAttachAndCancel) {
EXPECT_EQ(panel_new_bounds, panel->GetBounds());
// Continue dragging up the panel to trigger the detach again.
- gfx::Point drag_delta_to_detach_again = GetDragDeltaToDetach();
+ gfx::Vector2d drag_delta_to_detach_again = GetDragDeltaToDetach();
mouse_location = mouse_location.Add(drag_delta_to_detach_again);
panel_testing->DragTitlebar(mouse_location);
ASSERT_EQ(0, docked_strip->num_panels());
@@ -1131,7 +1131,7 @@ IN_PROC_BROWSER_TEST_F(PanelDragBrowserTest, DetachWithSqueeze) {
DockedPanelStrip* docked_strip = panel_manager->docked_strip();
DetachedPanelStrip* detached_strip = panel_manager->detached_strip();
- gfx::Point drag_delta_to_detach = GetDragDeltaToDetach();
+ gfx::Vector2d drag_delta_to_detach = GetDragDeltaToDetach();
// Create some docked panels.
// docked: P1 P2 P3 P4 P5

Powered by Google App Engine
This is Rietveld 408576698