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

Side by Side Diff: chrome/browser/chromeos/setting_level_bubble_browsertest.cc

Issue 8319008: aura: brightness and volume bubble. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 1 month 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) 2011 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 "base/message_loop.h"
6 #include "chrome/browser/chromeos/setting_level_bubble.h"
7 #include "chrome/browser/chromeos/setting_level_bubble_view.h"
8 #include "chrome/test/base/in_process_browser_test.h"
9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "views/controls/progress_bar.h"
11 #include "views/view.h"
12
13
14 class SettingLevelBubbleTest : public InProcessBrowserTest {
15 public:
16 SettingLevelBubbleTest() {
17 up_icon_.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
18 down_icon_.setConfig(SkBitmap::kARGB_8888_Config, 5, 5);
19 mute_icon_.setConfig(SkBitmap::kARGB_8888_Config, 1, 1);
20 }
21
22 virtual ~SettingLevelBubbleTest() {}
23
24 protected:
25 SkBitmap up_icon_;
26 SkBitmap down_icon_;
27 SkBitmap mute_icon_;
28
29 private:
30 DISALLOW_COPY_AND_ASSIGN(SettingLevelBubbleTest);
31 };
32
33 namespace chromeos {
34
35 IN_PROC_BROWSER_TEST_F(SettingLevelBubbleTest, CreateAndUpdate) {
36 SettingLevelBubble bubble(&up_icon_,
37 &down_icon_,
38 &mute_icon_);
39 EXPECT_EQ(NULL, bubble.view_);
40 EXPECT_EQ(&up_icon_, bubble.increase_icon_);
41 EXPECT_EQ(&down_icon_, bubble.decrease_icon_);
42 EXPECT_EQ(&mute_icon_, bubble.disabled_icon_);
43
44 // Update setting:
45 // Old target is 50, new target is 70, set enable = false.
46 bubble.ShowBubble(70, false);
47 EXPECT_TRUE(bubble.view_->GetWidget()->IsVisible());
48 EXPECT_EQ(&mute_icon_, bubble.view_->icon_);
49 EXPECT_FALSE(bubble.view_->progress_bar_->IsEnabled());
50
51 // Old target is 70, new target is 30, set enable = true.
52 bubble.ShowBubble(30, true);
53 EXPECT_EQ(&down_icon_, bubble.view_->icon_);
54 EXPECT_TRUE(bubble.view_->progress_bar_->IsEnabled());
55
56 // Old target is 30, new target is 40, set enable = true.
57 bubble.ShowBubble(30, true);
58 EXPECT_EQ(&up_icon_, bubble.view_->icon_);
59 EXPECT_TRUE(bubble.view_->progress_bar_->IsEnabled());
60
61 // Old target is 30, new target is 0, set enable = true.
62 bubble.ShowBubble(0, true);
63 EXPECT_EQ(&mute_icon_, bubble.view_->icon_);
64 EXPECT_TRUE(bubble.view_->progress_bar_->IsEnabled());
65 bubble.HideBubble();
66 MessageLoop::current()->RunAllPending();
67 }
68
69 IN_PROC_BROWSER_TEST_F(SettingLevelBubbleTest, ShowBubble) {
70 // Create setting at 30 percent, enabled.
71 SettingLevelBubble bubble(&up_icon_,
72 &down_icon_,
73 &mute_icon_);
74 bubble.UpdateWithoutShowingBubble(30, false);
75 EXPECT_EQ(NULL, bubble.view_);
76 EXPECT_EQ(30, bubble.current_percent_);
77
78 // Show bubble at 40 percent, enabled.
79 bubble.ShowBubble(40, true);
80 EXPECT_TRUE(bubble.view_ != NULL);
81 EXPECT_TRUE(bubble.view_->GetWidget()->IsVisible());
82
83 // Update to 0 percent and close.
84 bubble.UpdateWithoutShowingBubble(0, true);
85 bubble.OnWidgetClosing(bubble.view_->GetWidget());
86 EXPECT_EQ(0, bubble.current_percent_);
87 }
88
89 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/setting_level_bubble.cc ('k') | chrome/browser/chromeos/setting_level_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698