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

Side by Side Diff: ui/aura_shell/drag_drop_controller_unittest.cc

Issue 8682029: Make drag and drop work on webpage. Also slightly modify drag drop workflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: modified according to comments Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/drag_drop_controller.cc ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "ui/aura_shell/drag_drop_controller.h" 5 #include "ui/aura_shell/drag_drop_controller.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/desktop.h" 10 #include "ui/aura/desktop.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 drop_received_ = false; 112 drop_received_ = false;
113 drag_string_.clear(); 113 drag_string_.clear();
114 } 114 }
115 115
116 bool drag_start_received_; 116 bool drag_start_received_;
117 int num_drag_updates_; 117 int num_drag_updates_;
118 bool drop_received_; 118 bool drop_received_;
119 string16 drag_string_; 119 string16 drag_string_;
120 120
121 private: 121 private:
122 void StartDragAndDrop(const ui::OSExchangeData& data, 122 int StartDragAndDrop(const ui::OSExchangeData& data,
123 int operation) OVERRIDE { 123 int operation) OVERRIDE {
124 DragDropController::StartDragAndDrop(data, operation);
125 drag_start_received_ = true; 124 drag_start_received_ = true;
126 data.GetString(&drag_string_); 125 data.GetString(&drag_string_);
126 return DragDropController::StartDragAndDrop(data, operation);
127 } 127 }
128 128
129 void DragUpdate(aura::Window* target, 129 void DragUpdate(aura::Window* target,
130 const aura::MouseEvent& event) OVERRIDE { 130 const aura::MouseEvent& event) OVERRIDE {
131 DragDropController::DragUpdate(target, event); 131 DragDropController::DragUpdate(target, event);
132 num_drag_updates_++; 132 num_drag_updates_++;
133 } 133 }
134 134
135 void Drop(aura::Window* target, const aura::MouseEvent& event) OVERRIDE { 135 void Drop(aura::Window* target, const aura::MouseEvent& event) OVERRIDE {
136 DragDropController::Drop(target, event); 136 DragDropController::Drop(target, event);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 EXPECT_EQ(1, drag_view1->num_drag_enters_); 351 EXPECT_EQ(1, drag_view1->num_drag_enters_);
352 int num_expected_updates = drag_view1->bounds().width() - 352 int num_expected_updates = drag_view1->bounds().width() -
353 drag_view1->bounds().CenterPoint().x() - 2; 353 drag_view1->bounds().CenterPoint().x() - 2;
354 EXPECT_EQ(num_expected_updates - drag_view1->HorizontalDragThreshold(), 354 EXPECT_EQ(num_expected_updates - drag_view1->HorizontalDragThreshold(),
355 drag_view1->num_drag_updates_); 355 drag_view1->num_drag_updates_);
356 EXPECT_EQ(0, drag_view1->num_drops_); 356 EXPECT_EQ(0, drag_view1->num_drops_);
357 EXPECT_EQ(1, drag_view1->num_drag_exits_); 357 EXPECT_EQ(1, drag_view1->num_drag_exits_);
358 EXPECT_TRUE(drag_view1->drag_done_received_); 358 EXPECT_TRUE(drag_view1->drag_done_received_);
359 359
360 EXPECT_EQ(1, drag_view2->num_drag_enters_); 360 EXPECT_EQ(1, drag_view2->num_drag_enters_);
361 num_expected_updates = num_drags - num_expected_updates - 2; 361 num_expected_updates = num_drags - num_expected_updates - 1;
362 EXPECT_EQ(num_expected_updates, drag_view2->num_drag_updates_); 362 EXPECT_EQ(num_expected_updates, drag_view2->num_drag_updates_);
363 EXPECT_EQ(1, drag_view2->num_drops_); 363 EXPECT_EQ(1, drag_view2->num_drops_);
364 EXPECT_EQ(0, drag_view2->num_drag_exits_); 364 EXPECT_EQ(0, drag_view2->num_drag_exits_);
365 EXPECT_FALSE(drag_view2->drag_done_received_); 365 EXPECT_FALSE(drag_view2->drag_done_received_);
366 delete widget1; 366 delete widget1;
367 delete widget2; 367 delete widget2;
368 } 368 }
369 369
370 TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) { 370 TEST_F(DragDropControllerTest, ViewRemovedWhileInDragDropTest) {
371 views::Widget* widget = CreateNewWidget(); 371 views::Widget* widget = CreateNewWidget();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 EXPECT_EQ(num_drags_1 - 1 - drag_view->VerticalDragThreshold(), 417 EXPECT_EQ(num_drags_1 - 1 - drag_view->VerticalDragThreshold(),
418 drag_view->num_drag_updates_); 418 drag_view->num_drag_updates_);
419 EXPECT_EQ(0, drag_view->num_drops_); 419 EXPECT_EQ(0, drag_view->num_drops_);
420 EXPECT_EQ(0, drag_view->num_drag_exits_); 420 EXPECT_EQ(0, drag_view->num_drag_exits_);
421 EXPECT_TRUE(drag_view->drag_done_received_); 421 EXPECT_TRUE(drag_view->drag_done_received_);
422 delete widget; 422 delete widget;
423 } 423 }
424 424
425 } // namespace test 425 } // namespace test
426 } // namespace aura 426 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura_shell/drag_drop_controller.cc ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698