Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "views/events/event.h" | 27 #include "views/events/event.h" |
| 28 #include "views/focus/focus_manager.h" | 28 #include "views/focus/focus_manager.h" |
| 29 #include "views/ime/mock_input_method.h" | 29 #include "views/ime/mock_input_method.h" |
| 30 #include "views/ime/text_input_client.h" | 30 #include "views/ime/text_input_client.h" |
| 31 #include "views/test/test_views_delegate.h" | 31 #include "views/test/test_views_delegate.h" |
| 32 #include "views/test/views_test_base.h" | 32 #include "views/test/views_test_base.h" |
| 33 #include "views/views_delegate.h" | 33 #include "views/views_delegate.h" |
| 34 #include "views/widget/native_widget_private.h" | 34 #include "views/widget/native_widget_private.h" |
| 35 #include "views/widget/widget.h" | 35 #include "views/widget/widget.h" |
| 36 | 36 |
| 37 // Bug 99128. | 37 // Bugs http://crbug.com/99128, and http://crbug.com/97845 |
| 38 #if defined(USE_AURA) | 38 #if defined(USE_AURA) |
| 39 #define MAYBE_KeyTest FAILS_KeyTest | 39 #define MAYBE_KeyTest DISABLED_KeyTest |
|
sky
2011/10/05 20:28:03
These don't crash on windows (as far as I know). C
sadrul
2011/10/05 20:42:36
It turns out just the drag-n-drop related tests cr
| |
| 40 #define MAYBE_ControlAndSelectTest FAILS_ControlAndSelectTest | 40 #define MAYBE_ControlAndSelectTest DISABLED_ControlAndSelectTest |
| 41 #define MAYBE_InsertionDeletionTest FAILS_InsertionDeletionTest | 41 #define MAYBE_InsertionDeletionTest DISABLED_InsertionDeletionTest |
| 42 #define MAYBE_OnKeyPressReturnValueTest FAILS_OnKeyPressReturnValueTest | 42 #define MAYBE_OnKeyPressReturnValueTest DISABLED_OnKeyPressReturnValueTest |
| 43 #define MAYBE_CursorMovement FAILS_CursorMovement | 43 #define MAYBE_CursorMovement DISABLED_CursorMovement |
| 44 #define MAYBE_DragAndDrop_ToTheRight FAILS_DragAndDrop_ToTheRight | 44 #define MAYBE_DragAndDrop_ToTheRight DISABLED_DragAndDrop_ToTheRight |
| 45 #define MAYBE_DragAndDrop_ToTheLeft FAILS_DragAndDrop_ToTheLeft | 45 #define MAYBE_DragAndDrop_ToTheLeft DISABLED_DragAndDrop_ToTheLeft |
| 46 #define MAYBE_ReadOnlyTest FAILS_ReadOnlyTest | 46 #define MAYBE_ReadOnlyTest DISABLED_ReadOnlyTest |
| 47 #define MAYBE_TextInputClientTest FAILS_TextInputClientTest | 47 #define MAYBE_TextInputClientTest DISABLED_TextInputClientTest |
| 48 #define MAYBE_UndoRedoTest FAILS_UndoRedoTest | 48 #define MAYBE_UndoRedoTest DISABLED_UndoRedoTest |
| 49 #define MAYBE_TextCursorDisplayTest FAILS_TextCursorDisplayTest | 49 #define MAYBE_TextCursorDisplayTest DISABLED_TextCursorDisplayTest |
| 50 #define MAYBE_TextCursorDisplayInRTLTest FAILS_TextCursorDisplayInRTLTest | 50 #define MAYBE_TextCursorDisplayInRTLTest DISABLED_TextCursorDisplayInRTLTest |
| 51 #define MAYBE_HitOutsideTextAreaTest FAILS_HitOutsideTextAreaTest | 51 #define MAYBE_HitOutsideTextAreaTest DISABLED_HitOutsideTextAreaTest |
| 52 #define MAYBE_HitOutsideTextAreaInRTLTest FAILS_HitOutsideTextAreaInRTLTest | 52 #define MAYBE_HitOutsideTextAreaInRTLTest DISABLED_HitOutsideTextAreaInRTLTest |
| 53 #define MAYBE_OverflowTest FAILS_OverflowTest | 53 #define MAYBE_OverflowTest DISABLED_OverflowTest |
| 54 #define MAYBE_OverflowInRTLTest FAILS_OverflowInRTLTest | 54 #define MAYBE_OverflowInRTLTest DISABLED_OverflowInRTLTest |
| 55 #define MAYBE_DragAndDrop_InitiateDrag DISABLED_DragAndDrop_InitiateDrag | |
| 56 #define MAYBE_DragAndDrop_Canceled DISABLED_DragAndDrop_Canceled | |
| 55 #else | 57 #else |
| 56 #define MAYBE_KeyTest KeyTest | 58 #define MAYBE_KeyTest KeyTest |
| 57 #define MAYBE_ControlAndSelectTest ControlAndSelectTest | 59 #define MAYBE_ControlAndSelectTest ControlAndSelectTest |
| 58 #define MAYBE_InsertionDeletionTest InsertionDeletionTest | 60 #define MAYBE_InsertionDeletionTest InsertionDeletionTest |
| 59 #define MAYBE_OnKeyPressReturnValueTest OnKeyPressReturnValueTest | 61 #define MAYBE_OnKeyPressReturnValueTest OnKeyPressReturnValueTest |
| 60 #define MAYBE_CursorMovement CursorMovement | 62 #define MAYBE_CursorMovement CursorMovement |
| 61 #define MAYBE_DragAndDrop_ToTheRight DragAndDrop_ToTheRight | 63 #define MAYBE_DragAndDrop_ToTheRight DragAndDrop_ToTheRight |
| 62 #define MAYBE_DragAndDrop_ToTheLeft DragAndDrop_ToTheLeft | 64 #define MAYBE_DragAndDrop_ToTheLeft DragAndDrop_ToTheLeft |
| 63 #define MAYBE_ReadOnlyTest ReadOnlyTest | 65 #define MAYBE_ReadOnlyTest ReadOnlyTest |
| 64 #define MAYBE_TextInputClientTest TextInputClientTest | 66 #define MAYBE_TextInputClientTest TextInputClientTest |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 #else | 805 #else |
| 804 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. | 806 // Skip OSExchangeDataProviderWin::SetURL, which also sets CF_TEXT / STRING. |
| 805 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); | 807 bad_data.SetURL(GURL("x.org"), string16(ASCIIToUTF16("x"))); |
| 806 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); | 808 bad_data.SetPickledData(GDK_SELECTION_PRIMARY, Pickle()); |
| 807 #endif | 809 #endif |
| 808 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); | 810 EXPECT_FALSE(textfield_view_->CanDrop(bad_data)); |
| 809 } | 811 } |
| 810 #endif | 812 #endif |
| 811 | 813 |
| 812 #if !defined(TOUCH_UI) | 814 #if !defined(TOUCH_UI) |
| 813 TEST_F(NativeTextfieldViewsTest, DragAndDrop_InitiateDrag) { | 815 TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_InitiateDrag) { |
| 814 InitTextfield(Textfield::STYLE_DEFAULT); | 816 InitTextfield(Textfield::STYLE_DEFAULT); |
| 815 textfield_->SetText(ASCIIToUTF16("hello string world")); | 817 textfield_->SetText(ASCIIToUTF16("hello string world")); |
| 816 | 818 |
| 817 // Ensure the textfield will provide selected text for drag data. | 819 // Ensure the textfield will provide selected text for drag data. |
| 818 string16 string; | 820 string16 string; |
| 819 ui::OSExchangeData data; | 821 ui::OSExchangeData data; |
| 820 textfield_->SelectSelectionModel(gfx::SelectionModel(6, 12)); | 822 textfield_->SelectSelectionModel(gfx::SelectionModel(6, 12)); |
| 821 const gfx::Point kStringPoint(GetCursorPositionX(9), 0); | 823 const gfx::Point kStringPoint(GetCursorPositionX(9), 0); |
| 822 textfield_view_->WriteDragDataForView(NULL, kStringPoint, &data); | 824 textfield_view_->WriteDragDataForView(NULL, kStringPoint, &data); |
| 823 EXPECT_TRUE(data.GetString(&string)); | 825 EXPECT_TRUE(data.GetString(&string)); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 SendKeyEvent(ui::VKEY_Z, false, true); | 949 SendKeyEvent(ui::VKEY_Z, false, true); |
| 948 EXPECT_STR_EQ("", textfield_->text()); | 950 EXPECT_STR_EQ("", textfield_->text()); |
| 949 SendKeyEvent(ui::VKEY_Y, false, true); | 951 SendKeyEvent(ui::VKEY_Y, false, true); |
| 950 EXPECT_STR_EQ("hello world", textfield_->text()); | 952 EXPECT_STR_EQ("hello world", textfield_->text()); |
| 951 SendKeyEvent(ui::VKEY_Y, false, true); | 953 SendKeyEvent(ui::VKEY_Y, false, true); |
| 952 EXPECT_STR_EQ("h worlellod", textfield_->text()); | 954 EXPECT_STR_EQ("h worlellod", textfield_->text()); |
| 953 SendKeyEvent(ui::VKEY_Y, false, true); | 955 SendKeyEvent(ui::VKEY_Y, false, true); |
| 954 EXPECT_STR_EQ("h worlellod", textfield_->text()); | 956 EXPECT_STR_EQ("h worlellod", textfield_->text()); |
| 955 } | 957 } |
| 956 | 958 |
| 957 TEST_F(NativeTextfieldViewsTest, DragAndDrop_Canceled) { | 959 TEST_F(NativeTextfieldViewsTest, MAYBE_DragAndDrop_Canceled) { |
| 958 InitTextfield(Textfield::STYLE_DEFAULT); | 960 InitTextfield(Textfield::STYLE_DEFAULT); |
| 959 textfield_->SetText(ASCIIToUTF16("hello world")); | 961 textfield_->SetText(ASCIIToUTF16("hello world")); |
| 960 | 962 |
| 961 // Start dragging "worl". | 963 // Start dragging "worl". |
| 962 textfield_->SelectSelectionModel(gfx::SelectionModel(6, 10)); | 964 textfield_->SelectSelectionModel(gfx::SelectionModel(6, 10)); |
| 963 MouseEvent click(ui::ET_MOUSE_PRESSED, GetCursorPositionX(8), 0, | 965 MouseEvent click(ui::ET_MOUSE_PRESSED, GetCursorPositionX(8), 0, |
| 964 ui::EF_LEFT_BUTTON_DOWN); | 966 ui::EF_LEFT_BUTTON_DOWN); |
| 965 textfield_view_->OnMousePressed(click); | 967 textfield_view_->OnMousePressed(click); |
| 966 ui::OSExchangeData data; | 968 ui::OSExchangeData data; |
| 967 textfield_view_->WriteDragDataForView(NULL, click.location(), &data); | 969 textfield_view_->WriteDragDataForView(NULL, click.location(), &data); |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1567 EXPECT_EQ(0U, textfield_->GetCursorPosition()); | 1569 EXPECT_EQ(0U, textfield_->GetCursorPosition()); |
| 1568 #else | 1570 #else |
| 1569 EXPECT_EQ(500U, textfield_->GetCursorPosition()); | 1571 EXPECT_EQ(500U, textfield_->GetCursorPosition()); |
| 1570 #endif | 1572 #endif |
| 1571 | 1573 |
| 1572 // Reset locale. | 1574 // Reset locale. |
| 1573 base::i18n::SetICUDefaultLocale(locale); | 1575 base::i18n::SetICUDefaultLocale(locale); |
| 1574 } | 1576 } |
| 1575 | 1577 |
| 1576 } // namespace views | 1578 } // namespace views |
| OLD | NEW |