summaryrefslogtreecommitdiffstats
path: root/ash/test/display_manager_test_api.h
blob: 4bb070d438d581e5720c0ed9c53b17f1af399b53 (plain)
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
89
90
91
92
93
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_TEST_DISPLAY_MANAGER_TEST_API_H_
#define ASH_TEST_DISPLAY_MANAGER_TEST_API_H_

#include <string>
#include <vector>

#include "base/basictypes.h"
#include "ui/display/types/display_constants.h"

namespace gfx {
class Point;
class Size;
}

namespace ui {
namespace test {
class EventGenerator;
}
}

namespace ash {
class DisplayManager;

namespace test {

class DisplayManagerTestApi {
 public:
  // Test if moving a mouse to |point_in_screen| warps it to another
  // display.
  static bool TestIfMouseWarpsAt(ui::test::EventGenerator& event_generator,
                                 const gfx::Point& point_in_screen);

  DisplayManagerTestApi();
  virtual ~DisplayManagerTestApi();

  // Update the display configuration as given in |display_specs|. The format of
  // |display_spec| is a list of comma separated spec for each displays. Please
  // refer to the comment in |ash::DisplayInfo::CreateFromSpec| for the format
  // of the display spec.
  void UpdateDisplay(const std::string& display_specs);

  // Set the 1st display as an internal display and returns the display Id for
  // the internal display.
  int64 SetFirstDisplayAsInternalDisplay();

  // Don't update the display when the root window's size was changed.
  void DisableChangeDisplayUponHostResize();

  // Sets the available color profiles for |display_id|.
  void SetAvailableColorProfiles(
      int64 display_id,
      const std::vector<ui::ColorCalibrationProfile>& profiles);

 private:
  friend class ScopedSetInternalDisplayId;
  // Sets the display id for internal display and
  // update the display mode list if necessary.
  void SetInternalDisplayId(int64 id);

  DisplayManager* display_manager_;  // not owned

  DISALLOW_COPY_AND_ASSIGN(DisplayManagerTestApi);
};

class ScopedDisable125DSFForUIScaling {
 public:
  ScopedDisable125DSFForUIScaling();
  ~ScopedDisable125DSFForUIScaling();

 private:
  DISALLOW_COPY_AND_ASSIGN(ScopedDisable125DSFForUIScaling);
};

class ScopedSetInternalDisplayId {
 public:
  ScopedSetInternalDisplayId(int64 id);
  ~ScopedSetInternalDisplayId();

 private:
  DISALLOW_COPY_AND_ASSIGN(ScopedSetInternalDisplayId);
};

// Sets the display mode that matches the |resolution| for |display_id|.
bool SetDisplayResolution(int64 display_id, const gfx::Size& resolution);

}  // namespace test
}  // namespace ash

#endif  // ASH_TEST_DISPLAY_MANAGER_TEST_API_H_