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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h" 5 #include "chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "ash/wm/window_state.h" 11 #include "ash/wm/window_state.h"
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h"
16 #include "base/run_loop.h" 17 #include "base/run_loop.h"
17 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "chrome/browser/chrome_notification_types.h" 20 #include "chrome/browser/chrome_notification_types.h"
20 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
21 #include "chrome/browser/ui/browser_commands.h" 22 #include "chrome/browser/ui/browser_commands.h"
22 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_list.h"
23 #include "chrome/browser/ui/browser_tabstrip.h" 24 #include "chrome/browser/ui/browser_tabstrip.h"
24 #include "chrome/browser/ui/tabs/tab_strip_model.h" 25 #include "chrome/browser/ui/tabs/tab_strip_model.h"
25 #include "chrome/browser/ui/views/frame/browser_view.h" 26 #include "chrome/browser/ui/views/frame/browser_view.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); 188 gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10);
188 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size)); 189 browser()->window()->SetBounds(gfx::Rect(work_area.origin(), half_size));
189 browser2->window()->SetBounds(gfx::Rect( 190 browser2->window()->SetBounds(gfx::Rect(
190 work_area.x() + half_size.width(), work_area.y(), 191 work_area.x() + half_size.width(), work_area.y(),
191 half_size.width(), half_size.height())); 192 half_size.width(), half_size.height()));
192 return browser2; 193 return browser2;
193 } 194 }
194 195
195 void TabDragControllerTest::SetWindowFinderForTabStrip( 196 void TabDragControllerTest::SetWindowFinderForTabStrip(
196 TabStrip* tab_strip, 197 TabStrip* tab_strip,
197 scoped_ptr<WindowFinder> window_finder) { 198 std::unique_ptr<WindowFinder> window_finder) {
198 ASSERT_TRUE(tab_strip->drag_controller_.get()); 199 ASSERT_TRUE(tab_strip->drag_controller_.get());
199 tab_strip->drag_controller_->window_finder_ = std::move(window_finder); 200 tab_strip->drag_controller_->window_finder_ = std::move(window_finder);
200 } 201 }
201 202
202 namespace { 203 namespace {
203 204
204 enum InputSource { 205 enum InputSource {
205 INPUT_SOURCE_MOUSE = 0, 206 INPUT_SOURCE_MOUSE = 0,
206 INPUT_SOURCE_TOUCH = 1 207 INPUT_SOURCE_TOUCH = 1
207 }; 208 };
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 } 532 }
532 533
533 void AddBlankTabAndShow(Browser* browser) { 534 void AddBlankTabAndShow(Browser* browser) {
534 InProcessBrowserTest::AddBlankTabAndShow(browser); 535 InProcessBrowserTest::AddBlankTabAndShow(browser);
535 } 536 }
536 537
537 Browser* browser() const { return InProcessBrowserTest::browser(); } 538 Browser* browser() const { return InProcessBrowserTest::browser(); }
538 539
539 private: 540 private:
540 #if defined(OS_CHROMEOS) 541 #if defined(OS_CHROMEOS)
541 scoped_ptr<ui::test::EventGenerator> event_generator_; 542 std::unique_ptr<ui::test::EventGenerator> event_generator_;
542 #endif 543 #endif
543 544
544 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); 545 DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest);
545 }; 546 };
546 547
547 // Creates a browser with two tabs, drags the second to the first. 548 // Creates a browser with two tabs, drags the second to the first.
548 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) { 549 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, DragInSameWindow) {
549 // TODO(sky): this won't work with touch as it requires a long press. 550 // TODO(sky): this won't work with touch as it requires a long press.
550 if (input_source() == INPUT_SOURCE_TOUCH) { 551 if (input_source() == INPUT_SOURCE_TOUCH) {
551 VLOG(1) << "Test is DISABLED for touch input."; 552 VLOG(1) << "Test is DISABLED for touch input.";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest, 604 IN_PROC_BROWSER_TEST_P(DetachToBrowserTabDragControllerTest,
604 DragWithMaskedWindows) { 605 DragWithMaskedWindows) {
605 AddTabAndResetBrowser(browser()); 606 AddTabAndResetBrowser(browser());
606 607
607 aura::Window* browser_window = browser()->window()->GetNativeWindow(); 608 aura::Window* browser_window = browser()->window()->GetNativeWindow();
608 const gfx::Rect bounds = browser_window->GetBoundsInScreen(); 609 const gfx::Rect bounds = browser_window->GetBoundsInScreen();
609 aura::test::MaskedWindowDelegate masked_window_delegate( 610 aura::test::MaskedWindowDelegate masked_window_delegate(
610 gfx::Rect(bounds.width() - 10, 0, 10, bounds.height())); 611 gfx::Rect(bounds.width() - 10, 0, 10, bounds.height()));
611 gfx::Rect test(bounds); 612 gfx::Rect test(bounds);
612 masked_window_delegate.set_can_focus(false); 613 masked_window_delegate.set_can_focus(false);
613 scoped_ptr<aura::Window> masked_window( 614 std::unique_ptr<aura::Window> masked_window(
614 aura::test::CreateTestWindowWithDelegate(&masked_window_delegate, 10, 615 aura::test::CreateTestWindowWithDelegate(&masked_window_delegate, 10,
615 test, browser_window->parent())); 616 test, browser_window->parent()));
616 masked_window->SetEventTargeter( 617 masked_window->SetEventTargeter(
617 scoped_ptr<ui::EventTargeter>(new MaskedWindowTargeter())); 618 std::unique_ptr<ui::EventTargeter>(new MaskedWindowTargeter()));
618 619
619 ASSERT_FALSE(masked_window->GetEventHandlerForPoint( 620 ASSERT_FALSE(masked_window->GetEventHandlerForPoint(
620 gfx::Point(bounds.width() - 11, 0))); 621 gfx::Point(bounds.width() - 11, 0)));
621 ASSERT_TRUE(masked_window->GetEventHandlerForPoint( 622 ASSERT_TRUE(masked_window->GetEventHandlerForPoint(
622 gfx::Point(bounds.width() - 9, 0))); 623 gfx::Point(bounds.width() - 9, 0)));
623 TabStrip* tab_strip = GetTabStripForBrowser(browser()); 624 TabStrip* tab_strip = GetTabStripForBrowser(browser());
624 TabStripModel* model = browser()->tab_strip_model(); 625 TabStripModel* model = browser()->tab_strip_model();
625 626
626 gfx::Point tab_1_center(GetCenterInScreenCoordinates(tab_strip->tab_at(1))); 627 gfx::Point tab_1_center(GetCenterInScreenCoordinates(tab_strip->tab_at(1)));
627 ASSERT_TRUE(PressInput(tab_1_center)); 628 ASSERT_TRUE(PressInput(tab_1_center));
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 750
750 // Add another tab to browser(). 751 // Add another tab to browser().
751 AddTabAndResetBrowser(browser()); 752 AddTabAndResetBrowser(browser());
752 753
753 // Press on first tab so drag is active. Reset WindowFinder to one that causes 754 // Press on first tab so drag is active. Reset WindowFinder to one that causes
754 // capture to be lost from within GetLocalProcessWindowAtPoint(), then 755 // capture to be lost from within GetLocalProcessWindowAtPoint(), then
755 // continue drag. The capture lost should trigger the drag to cancel. 756 // continue drag. The capture lost should trigger the drag to cancel.
756 ASSERT_TRUE(PressInput(GetCenterInScreenCoordinates(tab_strip->tab_at(0)))); 757 ASSERT_TRUE(PressInput(GetCenterInScreenCoordinates(tab_strip->tab_at(0))));
757 ASSERT_TRUE(tab_strip->IsDragSessionActive()); 758 ASSERT_TRUE(tab_strip->IsDragSessionActive());
758 SetWindowFinderForTabStrip( 759 SetWindowFinderForTabStrip(
759 tab_strip, make_scoped_ptr(new CaptureLoseWindowFinder(tab_strip))); 760 tab_strip, base::WrapUnique(new CaptureLoseWindowFinder(tab_strip)));
760 ASSERT_TRUE(DragInputTo(GetCenterInScreenCoordinates(tab_strip->tab_at(1)))); 761 ASSERT_TRUE(DragInputTo(GetCenterInScreenCoordinates(tab_strip->tab_at(1))));
761 ASSERT_FALSE(tab_strip->IsDragSessionActive()); 762 ASSERT_FALSE(tab_strip->IsDragSessionActive());
762 } 763 }
763 764
764 namespace { 765 namespace {
765 766
766 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) { 767 void DetachToOwnWindowStep2(DetachToBrowserTabDragControllerTest* test) {
767 if (test->input_source() == INPUT_SOURCE_TOUCH) 768 if (test->input_source() == INPUT_SOURCE_TOUCH)
768 ASSERT_TRUE(test->ReleaseInput()); 769 ASSERT_TRUE(test->ReleaseInput());
769 } 770 }
(...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 DetachToBrowserTabDragControllerTest, 2412 DetachToBrowserTabDragControllerTest,
2412 ::testing::Values("mouse", "touch")); 2413 ::testing::Values("mouse", "touch"));
2413 INSTANTIATE_TEST_CASE_P(TabDragging, 2414 INSTANTIATE_TEST_CASE_P(TabDragging,
2414 DetachToBrowserTabDragControllerTestTouch, 2415 DetachToBrowserTabDragControllerTestTouch,
2415 ::testing::Values("touch")); 2416 ::testing::Values("touch"));
2416 #else 2417 #else
2417 INSTANTIATE_TEST_CASE_P(TabDragging, 2418 INSTANTIATE_TEST_CASE_P(TabDragging,
2418 DetachToBrowserTabDragControllerTest, 2419 DetachToBrowserTabDragControllerTest,
2419 ::testing::Values("mouse")); 2420 ::testing::Values("mouse"));
2420 #endif 2421 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.h ('k') | chrome/browser/ui/views/tabs/tab_strip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698