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

Side by Side Diff: athena/home/home_card_unittest.cc

Issue 408623003: Minimize HomeCard if the user opens something in the home card. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 5 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
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/home/public/home_card.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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.
4
5 #include "athena/home/public/home_card.h"
6
7 #include "athena/activity/public/activity_factory.h"
8 #include "athena/activity/public/activity_manager.h"
9 #include "athena/test/athena_test_base.h"
10 #include "athena/wm/public/window_manager.h"
11
12 namespace athena {
13
14 typedef test::AthenaTestBase HomeCardTest;
15
16 TEST_F(HomeCardTest, BasicTransition) {
17 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
18
19 WindowManager::GetInstance()->ToggleOverview();
20 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
21
22 WindowManager::GetInstance()->ToggleOverview();
23 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
24 }
25
26 TEST_F(HomeCardTest, VirtualKeyboardTransition) {
27 // Minimized -> Hidden for virtual keyboard.
28 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
29 const gfx::Rect vk_bounds(0, 0, 100, 100);
30 HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds);
31 EXPECT_EQ(HomeCard::HIDDEN, HomeCard::Get()->GetState());
32 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect());
33 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
34
35 // bottom -> centered for virtual keyboard.
36 WindowManager::GetInstance()->ToggleOverview();
37 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
38 HomeCard::Get()->UpdateVirtualKeyboardBounds(vk_bounds);
39 EXPECT_EQ(HomeCard::VISIBLE_CENTERED, HomeCard::Get()->GetState());
40 HomeCard::Get()->UpdateVirtualKeyboardBounds(gfx::Rect());
41 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
42
43 // Overview mode has to finish before ending test, otherwise it crashes.
44 // TODO(mukai): fix this.
45 WindowManager::GetInstance()->ToggleOverview();
46 }
47
48 // Verify if the home card is correctly minimized after app launch.
49 TEST_F(HomeCardTest, AppSelection) {
50 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
51
52 WindowManager::GetInstance()->ToggleOverview();
53 EXPECT_EQ(HomeCard::VISIBLE_BOTTOM, HomeCard::Get()->GetState());
54
55 athena::ActivityManager::Get()->AddActivity(
56 athena::ActivityFactory::Get()->CreateWebActivity(
57 NULL, GURL("http://www.google.com/")));
58 EXPECT_EQ(HomeCard::VISIBLE_MINIMIZED, HomeCard::Get()->GetState());
59
60 // Overview mode has to finish before ending test, otherwise it crashes.
61 // TODO(mukai): fix this.
62 WindowManager::GetInstance()->ToggleOverview();
63 }
64
65 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/home_card_impl.cc ('k') | athena/home/public/home_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698