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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 // Checks that IME-composition-event state is maintained correctly. | 753 // Checks that IME-composition-event state is maintained correctly. |
754 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { | 754 TEST_F(RenderWidgetHostViewAuraTest, SetCompositionText) { |
755 view_->InitAsChild(NULL); | 755 view_->InitAsChild(NULL); |
756 view_->Show(); | 756 view_->Show(); |
757 | 757 |
758 ui::CompositionText composition_text; | 758 ui::CompositionText composition_text; |
759 composition_text.text = base::ASCIIToUTF16("|a|b"); | 759 composition_text.text = base::ASCIIToUTF16("|a|b"); |
760 | 760 |
761 // Focused segment | 761 // Focused segment |
762 composition_text.underlines.push_back( | 762 composition_text.underlines.push_back( |
763 ui::CompositionUnderline(0, 3, 0xff000000, true)); | 763 ui::CompositionUnderline(0, 3, 0xff000000, true, 0x78563412)); |
764 | 764 |
765 // Non-focused segment | 765 // Non-focused segment, with different background color. |
766 composition_text.underlines.push_back( | 766 composition_text.underlines.push_back( |
767 ui::CompositionUnderline(3, 4, 0xff000000, false)); | 767 ui::CompositionUnderline(3, 4, 0xff000000, false, 0xefcdab90)); |
768 | 768 |
769 const ui::CompositionUnderlines& underlines = composition_text.underlines; | 769 const ui::CompositionUnderlines& underlines = composition_text.underlines; |
770 | 770 |
771 // Caret is at the end. (This emulates Japanese MSIME 2007 and later) | 771 // Caret is at the end. (This emulates Japanese MSIME 2007 and later) |
772 composition_text.selection = gfx::Range(4); | 772 composition_text.selection = gfx::Range(4); |
773 | 773 |
774 sink_->ClearMessages(); | 774 sink_->ClearMessages(); |
775 view_->SetCompositionText(composition_text); | 775 view_->SetCompositionText(composition_text); |
776 EXPECT_TRUE(view_->has_composition_text_); | 776 EXPECT_TRUE(view_->has_composition_text_); |
777 { | 777 { |
778 const IPC::Message* msg = | 778 const IPC::Message* msg = |
779 sink_->GetFirstMessageMatching(ViewMsg_ImeSetComposition::ID); | 779 sink_->GetFirstMessageMatching(ViewMsg_ImeSetComposition::ID); |
780 ASSERT_TRUE(msg != NULL); | 780 ASSERT_TRUE(msg != NULL); |
781 | 781 |
782 ViewMsg_ImeSetComposition::Param params; | 782 ViewMsg_ImeSetComposition::Param params; |
783 ViewMsg_ImeSetComposition::Read(msg, ¶ms); | 783 ViewMsg_ImeSetComposition::Read(msg, ¶ms); |
784 // composition text | 784 // composition text |
785 EXPECT_EQ(composition_text.text, params.a); | 785 EXPECT_EQ(composition_text.text, params.a); |
786 // underlines | 786 // underlines |
787 ASSERT_EQ(underlines.size(), params.b.size()); | 787 ASSERT_EQ(underlines.size(), params.b.size()); |
788 for (size_t i = 0; i < underlines.size(); ++i) { | 788 for (size_t i = 0; i < underlines.size(); ++i) { |
789 EXPECT_EQ(underlines[i].start_offset, params.b[i].startOffset); | 789 EXPECT_EQ(underlines[i].start_offset, params.b[i].startOffset); |
790 EXPECT_EQ(underlines[i].end_offset, params.b[i].endOffset); | 790 EXPECT_EQ(underlines[i].end_offset, params.b[i].endOffset); |
791 EXPECT_EQ(underlines[i].color, params.b[i].color); | 791 EXPECT_EQ(underlines[i].color, params.b[i].color); |
792 EXPECT_EQ(underlines[i].thick, params.b[i].thick); | 792 EXPECT_EQ(underlines[i].thick, params.b[i].thick); |
| 793 EXPECT_EQ(underlines[i].background_color, params.b[i].backgroundColor); |
793 } | 794 } |
794 // highlighted range | 795 // highlighted range |
795 EXPECT_EQ(4, params.c) << "Should be the same to the caret pos"; | 796 EXPECT_EQ(4, params.c) << "Should be the same to the caret pos"; |
796 EXPECT_EQ(4, params.d) << "Should be the same to the caret pos"; | 797 EXPECT_EQ(4, params.d) << "Should be the same to the caret pos"; |
797 } | 798 } |
798 | 799 |
799 view_->ImeCancelComposition(); | 800 view_->ImeCancelComposition(); |
800 EXPECT_FALSE(view_->has_composition_text_); | 801 EXPECT_FALSE(view_->has_composition_text_); |
801 } | 802 } |
802 | 803 |
(...skipping 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); | 2676 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->completed_mode()); |
2676 | 2677 |
2677 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, | 2678 SimulateGestureEvent(WebInputEvent::GestureScrollEnd, |
2678 blink::WebGestureDeviceTouchscreen); | 2679 blink::WebGestureDeviceTouchscreen); |
2679 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); | 2680 EXPECT_EQ(OVERSCROLL_NONE, overscroll_delegate()->current_mode()); |
2680 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); | 2681 EXPECT_EQ(OVERSCROLL_EAST, overscroll_delegate()->completed_mode()); |
2681 EXPECT_EQ(3U, sink_->message_count()); | 2682 EXPECT_EQ(3U, sink_->message_count()); |
2682 } | 2683 } |
2683 | 2684 |
2684 } // namespace content | 2685 } // namespace content |
OLD | NEW |