Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / accessibility / accessibility_mode_helper_unittest.cc
blob73388a19e9f04aaa320e5d1fe9f0d670cf7c8a43
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.
5 #include "content/browser/accessibility/accessibility_mode_helper.h"
6 #include "content/common/view_message_enums.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 #if defined(OS_WIN)
10 #include "base/win/windows_version.h"
11 #endif
13 namespace content {
15 TEST(AccessibilityModeHelperTest, TestNoOpRemove) {
16 EXPECT_EQ(AccessibilityModeComplete,
17 RemoveAccessibilityModeFrom(AccessibilityModeComplete,
18 AccessibilityModeOff));
21 TEST(AccessibilityModeHelperTest, TestRemoveSelf) {
22 AccessibilityMode kOffMode = AccessibilityModeOff;
23 #if defined(OS_WIN)
24 // Always preserve AccessibilityModeEditableTextOnly on Windows 8,
25 // see RemoveAccessibilityModeFrom() implementation.
26 // Test won't pass if switches::kDisableRendererAccessibility is set.
27 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
28 kOffMode = AccessibilityModeEditableTextOnly;
30 #endif // defined(OS_WIN)
32 EXPECT_EQ(kOffMode,
33 RemoveAccessibilityModeFrom(AccessibilityModeComplete,
34 AccessibilityModeComplete));
36 EXPECT_EQ(
37 kOffMode,
38 RemoveAccessibilityModeFrom(AccessibilityModeEditableTextOnly,
39 AccessibilityModeEditableTextOnly));
42 TEST(AccessibilityModeHelperTest, TestAddMode) {
43 EXPECT_EQ(
44 AccessibilityModeComplete,
45 AddAccessibilityModeTo(AccessibilityModeEditableTextOnly,
46 AccessibilityModeComplete));
47 EXPECT_EQ(
48 AccessibilityModeComplete,
49 AddAccessibilityModeTo(AccessibilityModeEditableTextOnly,
50 AccessibilityModeTreeOnly));
53 } // namespace content