| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 6 #include "content/common/accessibility_messages.h" | 6 #include "content/common/accessibility_messages.h" |
| 7 #include "content/common/accessibility_node_data.h" | 7 #include "content/common/accessibility_node_data.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "content/public/common/accessibility_mode.h" |
| 9 #include "content/public/test/render_view_test.h" | 10 #include "content/public/test/render_view_test.h" |
| 10 #include "content/renderer/render_view_impl.h" | 11 #include "content/renderer/render_view_impl.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 class RendererAccessibilityTest : public RenderViewTest { | 18 class RendererAccessibilityTest : public RenderViewTest { |
| 18 public: | 19 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 42 *params = param.a[0]; | 43 *params = param.a[0]; |
| 43 } | 44 } |
| 44 | 45 |
| 45 protected: | 46 protected: |
| 46 IPC::TestSink* sink_; | 47 IPC::TestSink* sink_; |
| 47 | 48 |
| 48 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityTest); | 49 DISALLOW_COPY_AND_ASSIGN(RendererAccessibilityTest); |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 TEST_F(RendererAccessibilityTest, EditableTextModeFocusNotifications) { | 52 TEST_F(RendererAccessibilityTest, EditableTextModeFocusNotifications) { |
| 52 SetMode(AccessibilityModeEditableTextOnly); | 53 SetMode(ACCESSIBILITY_MODE_EDITABLE_TEXT_ONLY); |
| 53 | 54 |
| 54 // Set a minimum size and give focus so simulated events work. | 55 // Set a minimum size and give focus so simulated events work. |
| 55 view()->webwidget()->resize(WebKit::WebSize(500, 500)); | 56 view()->webwidget()->resize(WebKit::WebSize(500, 500)); |
| 56 view()->webwidget()->setFocus(true); | 57 view()->webwidget()->setFocus(true); |
| 57 | 58 |
| 58 std::string html = | 59 std::string html = |
| 59 "<body>" | 60 "<body>" |
| 60 " <input>" | 61 " <input>" |
| 61 " <textarea></textarea>" | 62 " <textarea></textarea>" |
| 62 " <p contentEditable>Editable</p>" | 63 " <p contentEditable>Editable</p>" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 SCOPED_TRACE("Back to document."); | 184 SCOPED_TRACE("Back to document."); |
| 184 sink_->ClearMessages(); | 185 sink_->ClearMessages(); |
| 185 ExecuteJavaScript("document.activeElement.blur()"); | 186 ExecuteJavaScript("document.activeElement.blur()"); |
| 186 AccessibilityHostMsg_NotificationParams notification; | 187 AccessibilityHostMsg_NotificationParams notification; |
| 187 GetLastAccNotification(¬ification); | 188 GetLastAccNotification(¬ification); |
| 188 EXPECT_EQ(notification.id, 1); | 189 EXPECT_EQ(notification.id, 1); |
| 189 } | 190 } |
| 190 } | 191 } |
| 191 | 192 |
| 192 } // namespace content | 193 } // namespace content |
| OLD | NEW |