summaryrefslogtreecommitdiffstats
path: root/ash/test/launcher_view_test_api.h
blob: 41e74db9b2b18c059d740875a4df6bc2a881ebcf (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
// 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_LAUNCHER_VIEW_TEST_API_H_
#define ASH_TEST_LAUNCHER_VIEW_TEST_API_H_
#pragma once

#include "base/basictypes.h"

namespace gfx {
class Rect;
}

namespace ash {

namespace internal {
class LauncherButton;
class LauncherView;
}

namespace test {

// Use the api in this class to test LauncherView.
class LauncherViewTestAPI {
 public:
  explicit LauncherViewTestAPI(internal::LauncherView* launcher_view);
  ~LauncherViewTestAPI();

  // Number of icons displayed.
  int GetButtonCount();

  // Retrieve the button at |index|.
  internal::LauncherButton* GetButton(int index);

  // Last visible button index.
  int GetLastVisibleIndex();

  // Gets current/ideal bounds for button at |index|.
  const gfx::Rect& GetBoundsByIndex(int index);
  const gfx::Rect& GetIdealBoundsByIndex(int index);

  // Returns true if overflow button is visible.
  bool IsOverflowButtonVisible();

  // Sets animation duration in milliseconds for test.
  void SetAnimationDuration(int duration_ms);

  // Runs message loop and waits until all add/remove animations are done.
  void RunMessageLoopUntilAnimationsDone();

 private:
  internal::LauncherView* launcher_view_;

  DISALLOW_COPY_AND_ASSIGN(LauncherViewTestAPI);
};

}  // namespace test
}  // namespace ash

#endif  // ASH_TEST_LAUNCHER_VIEW_TEST_API_H_