summaryrefslogtreecommitdiffstats
path: root/views/controls/progress_bar_unittest.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 16:52:04 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 16:52:04 +0000
commitf5a51b22795117b60b3d4045eed9039a511d697a (patch)
tree739a4bdaf9e223fecf61ac407b2cb491098f2dd5 /views/controls/progress_bar_unittest.cc
parent44ce0b1adb867c77d02c45c2eb2a6c7ee3471167 (diff)
downloadchromium_src-f5a51b22795117b60b3d4045eed9039a511d697a.zip
chromium_src-f5a51b22795117b60b3d4045eed9039a511d697a.tar.gz
chromium_src-f5a51b22795117b60b3d4045eed9039a511d697a.tar.bz2
Implementation of a progress bar control.
BUG=37960 TEST=Unit tests provided, run chrome_tests. Checking in patch from Denis Romanov, reviewed as: http://codereview.chromium.org/889001/show Review URL: http://codereview.chromium.org/842007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls/progress_bar_unittest.cc')
-rw-r--r--views/controls/progress_bar_unittest.cc52
1 files changed, 52 insertions, 0 deletions
diff --git a/views/controls/progress_bar_unittest.cc b/views/controls/progress_bar_unittest.cc
new file mode 100644
index 0000000..1f653b7
--- /dev/null
+++ b/views/controls/progress_bar_unittest.cc
@@ -0,0 +1,52 @@
+// Copyright (c) 2010 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 "app/l10n_util.h"
+#include "base/string_util.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "views/controls/progress_bar.h"
+
+namespace views {
+
+TEST(ProgressBarTest, ProgressProperty) {
+ ProgressBar bar;
+ double progress = 0;
+ bar.SetProgress(-1);
+ progress = bar.GetProgress();
+ EXPECT_EQ(0, progress);
+ bar.SetProgress(3);
+ progress = bar.GetProgress();
+ EXPECT_EQ(1, progress);
+ bar.SetProgress(0.618);
+ progress = bar.GetProgress();
+ EXPECT_EQ(0.618, progress);
+}
+
+TEST(ProgressBarTest, TooltipTextProperty) {
+ ProgressBar bar;
+ std::wstring tooltip = L"Some text";
+ EXPECT_FALSE(bar.GetTooltipText(gfx::Point(), &tooltip));
+ EXPECT_EQ(L"", tooltip);
+ std::wstring tooltip_text = L"My progress";
+ bar.SetTooltipText(tooltip_text);
+ EXPECT_TRUE(bar.GetTooltipText(gfx::Point(), &tooltip));
+ EXPECT_EQ(tooltip_text, tooltip);
+}
+
+TEST(ProgressBarTest, Accessibility) {
+ ProgressBar bar;
+ bar.SetProgress(0.618);
+
+ AccessibilityTypes::Role role;
+ EXPECT_TRUE(bar.GetAccessibleRole(&role));
+ EXPECT_EQ(AccessibilityTypes::ROLE_TEXT, role);
+
+ // TODO(denisromanov): Test accessibility text here when it's implemented.
+
+ AccessibilityTypes::State state;
+ EXPECT_TRUE(bar.GetAccessibleState(&state));
+ EXPECT_EQ(AccessibilityTypes::STATE_READONLY, state);
+}
+
+} // namespace views