File: tab_drag_controller_interactive_uitest.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (88 lines) | stat: -rw-r--r-- 2,788 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_TABS_DRAGGING_TAB_DRAG_CONTROLLER_INTERACTIVE_UITEST_H_
#define CHROME_BROWSER_UI_VIEWS_TABS_DRAGGING_TAB_DRAG_CONTROLLER_INTERACTIVE_UITEST_H_

#include <string>

#include "base/memory/raw_ptr.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "url/url_constants.h"

class Browser;
class BrowserList;
class TabStrip;
class TabStripModel;
class WindowFinder;

namespace content {
class WebContents;
}

namespace ui {
class GestureEvent;
}

// TabDragControllerTest is the basis for the two tests that exercise
// TabDragController.
class TabDragControllerTest : public InProcessBrowserTest {
 public:
  TabDragControllerTest();
  TabDragControllerTest(const TabDragControllerTest&) = delete;
  TabDragControllerTest& operator=(const TabDragControllerTest&) = delete;
  ~TabDragControllerTest() override;

  // Cover for TabStrip::StopAnimating(true).
  void StopAnimating(TabStrip* tab_strip);

  // Adds `additional_tabs` new tabs to `browser` using the provided `url` or
  // blank. Stops animations and resets the ids of the tabs in `browser`.
  void AddTabsAndResetBrowser(Browser* browser,
                              int additional_tabs,
                              const GURL& url = GURL(url::kAboutBlankURL));

  // Resizes browser1 and browser2 to be side by side.
  void Resize(Browser* browser1, Browser* browser2);

  // Creates a new Browser and resizes browser() and the new browser to be side
  // by side.
  Browser* CreateAnotherBrowserAndResize();

  void SetWindowFinderForTabStrip(TabStrip* tab_strip,
                                  std::unique_ptr<WindowFinder> window_finder);

  const BrowserList* browser_list() const { return browser_list_; }

 protected:
  void HandleGestureEvent(TabStrip* tab_strip, ui::GestureEvent* event);

  bool HasDragStarted(TabStrip* tab_strip) const;

  // InProcessBrowserTest:
  void SetUp() override;

 private:
  raw_ptr<const BrowserList> browser_list_;
};

namespace test {

// Returns the TabStrip for `browser`.
TabStrip* GetTabStripForBrowser(Browser* browser);

// Sets the id of `web_contents` to `id`.
void SetID(content::WebContents* web_contents, int id);

// Resets the ids of all the tabs in `model` starting at `start`. That is, the
// id of the first tab is set to `start`, the second tab `start + 1` ...
void ResetIDs(TabStripModel* model, int start);

// Returns a string representation of the ids of the tabs in `model`. Each id
// is separated by a space.
std::string IDString(TabStripModel* model);

}  // namespace test

#endif  // CHROME_BROWSER_UI_VIEWS_TABS_DRAGGING_TAB_DRAG_CONTROLLER_INTERACTIVE_UITEST_H_