summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/brightness_bubble_browsertest.cc
blob: e6d837a3f668e8952f0cd2a98259309f3981b6c4 (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
32
33
// 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 "base/message_loop.h"
#include "chrome/browser/chromeos/brightness_bubble.h"
#include "chrome/browser/chromeos/setting_level_bubble_view.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "ui/views/view.h"

typedef InProcessBrowserTest BrightnessBubbleTest;

namespace chromeos {

IN_PROC_BROWSER_TEST_F(BrightnessBubbleTest, UpdateWithoutShowing) {
  BrightnessBubble* bubble = BrightnessBubble::GetInstance();
  bubble->UpdateWithoutShowingBubble(20, false);
  EXPECT_EQ(NULL, bubble->view_);
  EXPECT_EQ(20, bubble->current_percent_);
  bubble->UpdateWithoutShowingBubble(30, false);
  EXPECT_EQ(NULL, bubble->view_);
  EXPECT_EQ(20, bubble->current_percent_);
  EXPECT_EQ(30, bubble->target_percent_);
  bubble->UpdateWithoutShowingBubble(40, false);
  EXPECT_EQ(NULL, bubble->view_);
  EXPECT_EQ(40, bubble->target_percent_);
  bubble->ShowBubble(50, true);
  EXPECT_TRUE(bubble->view_->GetWidget()->IsVisible());
  EXPECT_EQ(50, bubble->target_percent_);
  MessageLoop::current()->RunAllPending();
}

}  // namespace chromeos