summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/launcher/launcher_unittest.cc
blob: eccef4d727ec6cfd3a3c068a2403ea92da07bfe8 (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
// Copyright (c) 2011 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.

#include "ui/aura_shell/launcher/launcher.h"

#include "ui/aura_shell/shell.h"
#include "ui/aura_shell/test/aura_shell_test_base.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"

typedef aura_shell::test::AuraShellTestBase LauncherTest;

namespace aura_shell {

// Makes sure invoking SetStatusWidth on the launcher changes the size of the
// LauncherView.
TEST_F(LauncherTest, SetStatusWidth) {
  Launcher* launcher = Shell::GetInstance()->launcher();
  ASSERT_TRUE(launcher);
  views::View* launcher_view = launcher->widget()->GetContentsView();
  ASSERT_EQ(1, launcher_view->child_count());
  launcher_view = launcher_view->child_at(0);

  int total_width = launcher->widget()->GetWindowScreenBounds().width();
  ASSERT_GT(total_width, 0);
  launcher->SetStatusWidth(total_width / 2);
  EXPECT_EQ(total_width - total_width / 2, launcher_view->width());
}

}  // namespace aura_shell