Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(261)

Side by Side Diff: ash/launcher/launcher_view_unittest.cc

Issue 9808026: Layout panels on top of their launcher icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempt at LauncherViewTest Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
sky 2012/04/13 17:32:15 I this doesn't work, don't bother checking it in.
4
5 #include "ash/wm/panel_layout_manager.h"
6
7 #include "ash/ash_switches.h"
8 #include "ash/launcher/launcher.h"
9 #include "ash/launcher/launcher_icon_observer.h"
10 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h"
12 #include "ash/test/ash_test_base.h"
13 #include "ash/test/test_launcher_delegate.h"
14 #include "base/basictypes.h"
15 #include "base/command_line.h"
16 #include "base/compiler_specific.h"
17 #include "ui/aura/window.h"
18 #include "ui/views/widget/widget.h"
19 #include "ui/views/widget/widget_delegate.h"
20
21 namespace ash {
22
23 namespace {
24
25 class LauncherViewTest : public ash::test::AshTestBase {
sky 2012/04/13 17:32:15 If you don't need to override anything, use a type
26 public:
27 LauncherViewTest() {}
28 virtual ~LauncherViewTest() {}
29
30 private:
31 DISALLOW_COPY_AND_ASSIGN(LauncherViewTest);
32 };
33
34 class TestLauncherIconObserver : public LauncherIconObserver {
35 public:
36 TestLauncherIconObserver() : count_(0) {
37 Shell::GetInstance()->launcher()->AddIconObserver(this);
38 }
39
40 virtual ~TestLauncherIconObserver() {
41 Shell::GetInstance()->launcher()->RemoveIconObserver(this);
42 }
43
44 void ExpectFiredAndReset() {
45 EXPECT_EQ(1, count_);
46 count_ = 0;
47 }
48
49 // LauncherIconObserver implementation.
50 void OnLauncherIconPositionsChanged() OVERRIDE {
51 count_++;
52 }
53 private:
sky 2012/04/13 17:32:15 nit: newline between 52/53.
54 int count_;
55
56 DISALLOW_COPY_AND_ASSIGN(TestLauncherIconObserver);
57 };
58
59 TEST_F(LauncherViewTest, AddingWindows) {
60 ash::test::TestLauncherDelegate* launcher_delegate =
61 static_cast<ash::test::TestLauncherDelegate*>(
62 Shell::GetInstance()->launcher()->delegate());
63
64 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
65 params.bounds = gfx::Rect(0,0,200,200);
sky 2012/04/13 17:32:15 nit: spaces after commas.
66
67 TestLauncherIconObserver observer;
68
69 views::Widget* w1 = new views::Widget();
70 w1->Init(params);
71 launcher_delegate->AddLauncherItem(w1->GetNativeWindow());
72 observer.ExpectFiredAndReset();
73 w1->Show();
74
75 // This test fails because removing child only fires events after
76 // fading out deleted element.
77 //w1->GetNativeWindow()->parent()->RemoveChild(w1->GetNativeWindow());
78 //observer.ExpectFiredAndReset();
79 }
80
81 }
82
83 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698