| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 TEST_F(RenderViewImplTest, BasicRenderFrame) { | 1720 TEST_F(RenderViewImplTest, BasicRenderFrame) { |
| 1721 EXPECT_TRUE(view()->main_render_frame_); | 1721 EXPECT_TRUE(view()->main_render_frame_); |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) { | 1724 TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) { |
| 1725 LoadHTML("<textarea id=\"test\"></textarea>"); | 1725 LoadHTML("<textarea id=\"test\"></textarea>"); |
| 1726 | 1726 |
| 1727 view()->SetHandlingInputEventForTesting(true); | 1727 view()->SetHandlingInputEventForTesting(true); |
| 1728 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); | 1728 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); |
| 1729 | 1729 |
| 1730 bool is_input_type_called = false; | 1730 int first_input_type = -1; |
| 1731 bool is_selection_called = false; | 1731 int first_selection = -1; |
| 1732 size_t last_input_type = 0; | |
| 1733 size_t last_selection = 0; | |
| 1734 | 1732 |
| 1735 for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) { | 1733 for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) { |
| 1736 const uint32_t type = render_thread_->sink().GetMessageAt(i)->type(); | 1734 const uint32_t type = render_thread_->sink().GetMessageAt(i)->type(); |
| 1737 if (type == ViewHostMsg_TextInputStateChanged::ID) { | 1735 if (type == ViewHostMsg_TextInputStateChanged::ID) { |
| 1738 is_input_type_called = true; | 1736 if (first_input_type == -1) |
| 1739 last_input_type = i; | 1737 first_input_type = static_cast<int>(i); |
| 1740 } else if (type == FrameHostMsg_SelectionChanged::ID) { | 1738 } else if (type == FrameHostMsg_SelectionChanged::ID) { |
| 1741 is_selection_called = true; | 1739 if (first_selection == -1) |
| 1742 last_selection = i; | 1740 first_selection = static_cast<int>(i); |
| 1743 } | 1741 } |
| 1744 } | 1742 } |
| 1745 | 1743 |
| 1746 EXPECT_TRUE(is_input_type_called); | 1744 EXPECT_NE(first_input_type, -1); |
| 1747 EXPECT_TRUE(is_selection_called); | 1745 EXPECT_NE(first_selection, -1); |
| 1748 | 1746 // InputTypeChange should be called earlier than SelectionChanged. |
| 1749 // InputTypeChange shold be called earlier than SelectionChanged. | 1747 EXPECT_LT(first_input_type, first_selection); |
| 1750 EXPECT_LT(last_input_type, last_selection); | |
| 1751 } | 1748 } |
| 1752 | 1749 |
| 1753 class RendererErrorPageTest : public RenderViewImplTest { | 1750 class RendererErrorPageTest : public RenderViewImplTest { |
| 1754 public: | 1751 public: |
| 1755 ContentRendererClient* CreateContentRendererClient() override { | 1752 ContentRendererClient* CreateContentRendererClient() override { |
| 1756 return new TestContentRendererClient; | 1753 return new TestContentRendererClient; |
| 1757 } | 1754 } |
| 1758 | 1755 |
| 1759 RenderViewImpl* view() { | 1756 RenderViewImpl* view() { |
| 1760 return static_cast<RenderViewImpl*>(view_); | 1757 return static_cast<RenderViewImpl*>(view_); |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 ExpectPauseAndResume(3); | 2510 ExpectPauseAndResume(3); |
| 2514 blink::WebScriptSource source2( | 2511 blink::WebScriptSource source2( |
| 2515 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2512 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
| 2516 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2513 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
| 2517 | 2514 |
| 2518 EXPECT_FALSE(IsPaused()); | 2515 EXPECT_FALSE(IsPaused()); |
| 2519 Detach(); | 2516 Detach(); |
| 2520 } | 2517 } |
| 2521 | 2518 |
| 2522 } // namespace content | 2519 } // namespace content |
| OLD | NEW |