summaryrefslogtreecommitdiffstats
path: root/ash/launcher/launcher_view_unittest.cc
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 00:45:22 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-20 00:45:22 +0000
commit3e238de9eee09390f4e197ef51a1593c77876dcb (patch)
tree0f5cda5296b7e499d844ce1f0e70845ec9740f4c /ash/launcher/launcher_view_unittest.cc
parent60fda4626b035bfab0b4e2c05be2203d8de3fe9b (diff)
downloadchromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.zip
chromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.tar.gz
chromium_src-3e238de9eee09390f4e197ef51a1593c77876dcb.tar.bz2
Revert 133089 - Implement LauncherIconObserver.
This will be used to listen for changes in the launcher view so that panels can be correctly drawn over the corresponding launcher icon. BUG=124115 TEST=aura_shell_unittests Review URL: https://chromiumcodereview.appspot.com/10116011 TBR=dcheng@chromium.org Review URL: https://chromiumcodereview.appspot.com/10142005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133103 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher/launcher_view_unittest.cc')
-rw-r--r--ash/launcher/launcher_view_unittest.cc104
1 files changed, 0 insertions, 104 deletions
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
deleted file mode 100644
index 78836f6..0000000
--- a/ash/launcher/launcher_view_unittest.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-// 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.
-
-#include "ash/launcher/launcher_view.h"
-
-#include "ash/ash_switches.h"
-#include "ash/launcher/launcher.h"
-#include "ash/launcher/launcher_icon_observer.h"
-#include "ash/shell.h"
-#include "ash/shell_window_ids.h"
-#include "ash/test/ash_test_base.h"
-#include "ash/test/test_launcher_delegate.h"
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/compiler_specific.h"
-#include "ui/aura/window.h"
-#include "ui/views/widget/widget.h"
-#include "ui/views/widget/widget_delegate.h"
-
-namespace ash {
-
-namespace {
-
-class TestLauncherIconObserver : public LauncherIconObserver {
- public:
- TestLauncherIconObserver() : count_(0) {
- Shell::GetInstance()->launcher()->AddIconObserver(this);
- }
-
- virtual ~TestLauncherIconObserver() {
- Shell::GetInstance()->launcher()->RemoveIconObserver(this);
- }
-
- // LauncherIconObserver implementation.
- void OnLauncherIconPositionsChanged() OVERRIDE {
- count_++;
- }
-
- int count() const { return count_; }
- void Reset() { count_ = 0; }
-
- private:
- int count_;
-
- DISALLOW_COPY_AND_ASSIGN(TestLauncherIconObserver);
-};
-
-class LauncherViewTest : public ash::test::AshTestBase {
- public:
- LauncherViewTest() {}
- virtual ~LauncherViewTest() {}
-
- virtual void SetUp() OVERRIDE {
- AshTestBase::SetUp();
- observer_.reset(new TestLauncherIconObserver);
- }
-
- virtual void TearDown() OVERRIDE {
- observer_.reset();
- AshTestBase::TearDown();
- }
-
- TestLauncherIconObserver* observer() { return observer_.get(); }
-
- private:
- scoped_ptr<TestLauncherIconObserver> observer_;
-
- DISALLOW_COPY_AND_ASSIGN(LauncherViewTest);
-};
-
-TEST_F(LauncherViewTest, AddRemove) {
- ash::test::TestLauncherDelegate* launcher_delegate =
- ash::test::TestLauncherDelegate::instance();
- ASSERT_TRUE(launcher_delegate);
-
- views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
- params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
- params.bounds = gfx::Rect(0, 0, 200, 200);
-
- scoped_ptr<views::Widget> widget(new views::Widget());
- widget->Init(params);
- launcher_delegate->AddLauncherItem(widget->GetNativeWindow());
- EXPECT_EQ(1, observer()->count());
- observer()->Reset();
-
- widget->Show();
- widget->GetNativeWindow()->parent()->RemoveChild(widget->GetNativeWindow());
- EXPECT_EQ(1, observer()->count());
- observer()->Reset();
-}
-
-TEST_F(LauncherViewTest, BoundsChanged) {
- Launcher* launcher = Shell::GetInstance()->launcher();
- int total_width = launcher->widget()->GetWindowScreenBounds().width();
- ASSERT_GT(total_width, 0);
- launcher->SetStatusWidth(total_width / 2);
- EXPECT_EQ(1, observer()->count());
- observer()->Reset();
-}
-
-} // namespace
-
-} // namespace ash