Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / views / controls / progress_bar_unittest.cc
blobb9067b20c9b3716f250fddb83a35e4f876b8ffcd
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.
5 #include "ui/views/controls/progress_bar.h"
7 #include "base/strings/utf_string_conversions.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/accessibility/ax_view_state.h"
11 namespace views {
13 TEST(ProgressBarTest, TooltipTextProperty) {
14 ProgressBar bar;
15 base::string16 tooltip = base::ASCIIToUTF16("Some text");
16 EXPECT_FALSE(bar.GetTooltipText(gfx::Point(), &tooltip));
17 EXPECT_EQ(base::string16(), tooltip);
18 base::string16 tooltip_text = base::ASCIIToUTF16("My progress");
19 bar.SetTooltipText(tooltip_text);
20 EXPECT_TRUE(bar.GetTooltipText(gfx::Point(), &tooltip));
21 EXPECT_EQ(tooltip_text, tooltip);
24 TEST(ProgressBarTest, Accessibility) {
25 ProgressBar bar;
26 bar.SetValue(62);
28 ui::AXViewState state;
29 bar.GetAccessibleState(&state);
30 EXPECT_EQ(ui::AX_ROLE_PROGRESS_INDICATOR, state.role);
31 EXPECT_EQ(base::string16(), state.name);
32 EXPECT_TRUE(state.HasStateFlag(ui::AX_STATE_READ_ONLY));
35 } // namespace views