Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>"); 421 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>");
422 422
423 // We should NOT have gotten a form state change notification yet. 423 // We should NOT have gotten a form state change notification yet.
424 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 424 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
425 ViewHostMsg_UpdateState::ID)); 425 ViewHostMsg_UpdateState::ID));
426 render_thread_->sink().ClearMessages(); 426 render_thread_->sink().ClearMessages();
427 427
428 // Change the value of the input. We should have gotten an update state 428 // Change the value of the input. We should have gotten an update state
429 // notification. We need to spin the message loop to catch this update. 429 // notification. We need to spin the message loop to catch this update.
430 ExecuteJavaScriptForTests( 430 ExecuteJavaScript("document.getElementById('elt_text').value = 'foo';");
431 "document.getElementById('elt_text').value = 'foo';");
432 ProcessPendingMessages(); 431 ProcessPendingMessages();
433 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( 432 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching(
434 ViewHostMsg_UpdateState::ID)); 433 ViewHostMsg_UpdateState::ID));
435 } 434 }
436 435
437 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { 436 TEST_F(RenderViewImplTest, OnNavigationHttpPost) {
438 // An http url will trigger a resource load so cannot be used here. 437 // An http url will trigger a resource load so cannot be used here.
439 CommonNavigationParams common_params; 438 CommonNavigationParams common_params;
440 StartNavigationParams start_params; 439 StartNavigationParams start_params;
441 RequestNavigationParams request_params; 440 RequestNavigationParams request_params;
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 {"test12", ui::TEXT_INPUT_MODE_EMAIL}, 956 {"test12", ui::TEXT_INPUT_MODE_EMAIL},
958 {"test13", ui::TEXT_INPUT_MODE_URL}, 957 {"test13", ui::TEXT_INPUT_MODE_URL},
959 {"test14", ui::TEXT_INPUT_MODE_DEFAULT}, 958 {"test14", ui::TEXT_INPUT_MODE_DEFAULT},
960 {"test15", ui::TEXT_INPUT_MODE_VERBATIM}, 959 {"test15", ui::TEXT_INPUT_MODE_VERBATIM},
961 }; 960 };
962 961
963 const int kRepeatCount = 10; 962 const int kRepeatCount = 10;
964 for (int i = 0; i < kRepeatCount; i++) { 963 for (int i = 0; i < kRepeatCount; i++) {
965 // Move the input focus to the first <input> element, where we should 964 // Move the input focus to the first <input> element, where we should
966 // activate IMEs. 965 // activate IMEs.
967 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 966 ExecuteJavaScript("document.getElementById('test1').focus();");
968 ProcessPendingMessages(); 967 ProcessPendingMessages();
969 render_thread_->sink().ClearMessages(); 968 render_thread_->sink().ClearMessages();
970 969
971 // Update the IME status and verify if our IME backend sends an IPC message 970 // Update the IME status and verify if our IME backend sends an IPC message
972 // to activate IMEs. 971 // to activate IMEs.
973 view()->UpdateTextInputType(); 972 view()->UpdateTextInputType();
974 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0); 973 const IPC::Message* msg = render_thread_->sink().GetMessageAt(0);
975 EXPECT_TRUE(msg != NULL); 974 EXPECT_TRUE(msg != NULL);
976 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); 975 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type());
977 ViewHostMsg_TextInputTypeChanged::Param params; 976 ViewHostMsg_TextInputTypeChanged::Param params;
978 ViewHostMsg_TextInputTypeChanged::Read(msg, &params); 977 ViewHostMsg_TextInputTypeChanged::Read(msg, &params);
979 ui::TextInputType type = base::get<0>(params); 978 ui::TextInputType type = base::get<0>(params);
980 ui::TextInputMode input_mode = base::get<1>(params); 979 ui::TextInputMode input_mode = base::get<1>(params);
981 bool can_compose_inline = base::get<2>(params); 980 bool can_compose_inline = base::get<2>(params);
982 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type); 981 EXPECT_EQ(ui::TEXT_INPUT_TYPE_TEXT, type);
983 EXPECT_EQ(true, can_compose_inline); 982 EXPECT_EQ(true, can_compose_inline);
984 983
985 // Move the input focus to the second <input> element, where we should 984 // Move the input focus to the second <input> element, where we should
986 // de-activate IMEs. 985 // de-activate IMEs.
987 ExecuteJavaScriptForTests("document.getElementById('test2').focus();"); 986 ExecuteJavaScript("document.getElementById('test2').focus();");
988 ProcessPendingMessages(); 987 ProcessPendingMessages();
989 render_thread_->sink().ClearMessages(); 988 render_thread_->sink().ClearMessages();
990 989
991 // Update the IME status and verify if our IME backend sends an IPC message 990 // Update the IME status and verify if our IME backend sends an IPC message
992 // to de-activate IMEs. 991 // to de-activate IMEs.
993 view()->UpdateTextInputType(); 992 view()->UpdateTextInputType();
994 msg = render_thread_->sink().GetMessageAt(0); 993 msg = render_thread_->sink().GetMessageAt(0);
995 EXPECT_TRUE(msg != NULL); 994 EXPECT_TRUE(msg != NULL);
996 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); 995 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type());
997 ViewHostMsg_TextInputTypeChanged::Read(msg, & params); 996 ViewHostMsg_TextInputTypeChanged::Read(msg, & params);
(...skipping 29 matching lines...) Expand all
1027 // Test that our IME backend can compose CJK words. 1026 // Test that our IME backend can compose CJK words.
1028 // Our IME front-end sends many platform-independent messages to the IME backend 1027 // Our IME front-end sends many platform-independent messages to the IME backend
1029 // while it composes CJK words. This test sends the minimal messages captured 1028 // while it composes CJK words. This test sends the minimal messages captured
1030 // on my local environment directly to the IME backend to verify if the backend 1029 // on my local environment directly to the IME backend to verify if the backend
1031 // can compose CJK words without any problems. 1030 // can compose CJK words without any problems.
1032 // This test uses an array of command sets because an IME composotion does not 1031 // This test uses an array of command sets because an IME composotion does not
1033 // only depends on IME events, but also depends on window events, e.g. moving 1032 // only depends on IME events, but also depends on window events, e.g. moving
1034 // the window focus while composing a CJK text. To handle such complicated 1033 // the window focus while composing a CJK text. To handle such complicated
1035 // cases, this test should not only call IME-related functions in the 1034 // cases, this test should not only call IME-related functions in the
1036 // RenderWidget class, but also call some RenderWidget members, e.g. 1035 // RenderWidget class, but also call some RenderWidget members, e.g.
1037 // ExecuteJavaScriptForTests(), RenderWidget::OnSetFocus(), etc. 1036 // ExecuteJavaScript(), RenderWidget::OnSetFocus(), etc.
1038 TEST_F(RenderViewImplTest, ImeComposition) { 1037 TEST_F(RenderViewImplTest, ImeComposition) {
1039 enum ImeCommand { 1038 enum ImeCommand {
1040 IME_INITIALIZE, 1039 IME_INITIALIZE,
1041 IME_SETINPUTMODE, 1040 IME_SETINPUTMODE,
1042 IME_SETFOCUS, 1041 IME_SETFOCUS,
1043 IME_SETCOMPOSITION, 1042 IME_SETCOMPOSITION,
1044 IME_CONFIRMCOMPOSITION, 1043 IME_CONFIRMCOMPOSITION,
1045 IME_CANCELCOMPOSITION 1044 IME_CANCELCOMPOSITION
1046 }; 1045 };
1047 struct ImeMessage { 1046 struct ImeMessage {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 // and move the input focus to the <div> element, where we can use 1101 // and move the input focus to the <div> element, where we can use
1103 // IMEs. 1102 // IMEs.
1104 view()->set_send_content_state_immediately(true); 1103 view()->set_send_content_state_immediately(true);
1105 LoadHTML("<html>" 1104 LoadHTML("<html>"
1106 "<head>" 1105 "<head>"
1107 "</head>" 1106 "</head>"
1108 "<body>" 1107 "<body>"
1109 "<div id=\"test1\" contenteditable=\"true\"></div>" 1108 "<div id=\"test1\" contenteditable=\"true\"></div>"
1110 "</body>" 1109 "</body>"
1111 "</html>"); 1110 "</html>");
1112 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 1111 ExecuteJavaScript("document.getElementById('test1').focus();");
1113 break; 1112 break;
1114 1113
1115 case IME_SETINPUTMODE: 1114 case IME_SETINPUTMODE:
1116 break; 1115 break;
1117 1116
1118 case IME_SETFOCUS: 1117 case IME_SETFOCUS:
1119 // Update the window focus. 1118 // Update the window focus.
1120 view()->OnSetFocus(ime_message->enable); 1119 view()->OnSetFocus(ime_message->enable);
1121 break; 1120 break;
1122 1121
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 1179
1181 static const struct { 1180 static const struct {
1182 WebTextDirection direction; 1181 WebTextDirection direction;
1183 const wchar_t* expected_result; 1182 const wchar_t* expected_result;
1184 } kTextDirection[] = { 1183 } kTextDirection[] = {
1185 { blink::WebTextDirectionRightToLeft, L"\x000A" L"rtl,rtl" }, 1184 { blink::WebTextDirectionRightToLeft, L"\x000A" L"rtl,rtl" },
1186 { blink::WebTextDirectionLeftToRight, L"\x000A" L"ltr,ltr" }, 1185 { blink::WebTextDirectionLeftToRight, L"\x000A" L"ltr,ltr" },
1187 }; 1186 };
1188 for (size_t i = 0; i < arraysize(kTextDirection); ++i) { 1187 for (size_t i = 0; i < arraysize(kTextDirection); ++i) {
1189 // Set the text direction of the <textarea> element. 1188 // Set the text direction of the <textarea> element.
1190 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); 1189 ExecuteJavaScript("document.getElementById('test').focus();");
1191 view()->OnSetTextDirection(kTextDirection[i].direction); 1190 view()->OnSetTextDirection(kTextDirection[i].direction);
1192 1191
1193 // Write the values of its DOM 'dir' attribute and its CSS 'direction' 1192 // Write the values of its DOM 'dir' attribute and its CSS 'direction'
1194 // property to the <div> element. 1193 // property to the <div> element.
1195 ExecuteJavaScriptForTests( 1194 ExecuteJavaScript("var result = document.getElementById('result');"
1196 "var result = document.getElementById('result');" 1195 "var node = document.getElementById('test');"
1197 "var node = document.getElementById('test');" 1196 "var style = getComputedStyle(node, null);"
1198 "var style = getComputedStyle(node, null);" 1197 "result.innerText ="
1199 "result.innerText =" 1198 " node.getAttribute('dir') + ',' +"
1200 " node.getAttribute('dir') + ',' +" 1199 " style.getPropertyValue('direction');");
1201 " style.getPropertyValue('direction');");
1202 1200
1203 // Copy the document content to std::wstring and compare with the 1201 // Copy the document content to std::wstring and compare with the
1204 // expected result. 1202 // expected result.
1205 const int kMaxOutputCharacters = 16; 1203 const int kMaxOutputCharacters = 16;
1206 base::string16 output = GetMainFrame()->contentAsText(kMaxOutputCharacters); 1204 base::string16 output = GetMainFrame()->contentAsText(kMaxOutputCharacters);
1207 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output); 1205 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output);
1208 } 1206 }
1209 } 1207 }
1210 1208
1211 // Test that we can receive correct DOM events when we send input events 1209 // Test that we can receive correct DOM events when we send input events
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 " onkeyup='return OnKeyEvent(event);'>" 1241 " onkeyup='return OnKeyEvent(event);'>"
1244 "</input>" 1242 "</input>"
1245 "<div id='keydown' contenteditable='true'>" 1243 "<div id='keydown' contenteditable='true'>"
1246 "</div>" 1244 "</div>"
1247 "<div id='keypress' contenteditable='true'>" 1245 "<div id='keypress' contenteditable='true'>"
1248 "</div>" 1246 "</div>"
1249 "<div id='keyup' contenteditable='true'>" 1247 "<div id='keyup' contenteditable='true'>"
1250 "</div>" 1248 "</div>"
1251 "</body>" 1249 "</body>"
1252 "</html>"); 1250 "</html>");
1253 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); 1251 ExecuteJavaScript("document.getElementById('test').focus();");
1254 render_thread_->sink().ClearMessages(); 1252 render_thread_->sink().ClearMessages();
1255 1253
1256 static const MockKeyboard::Layout kLayouts[] = { 1254 static const MockKeyboard::Layout kLayouts[] = {
1257 #if defined(OS_WIN) 1255 #if defined(OS_WIN)
1258 // Since we ignore the mock keyboard layout on Linux and instead just use 1256 // Since we ignore the mock keyboard layout on Linux and instead just use
1259 // the screen's keyboard layout, these trivially pass. They are commented 1257 // the screen's keyboard layout, these trivially pass. They are commented
1260 // out to avoid the illusion that they work. 1258 // out to avoid the illusion that they work.
1261 MockKeyboard::LAYOUT_ARABIC, 1259 MockKeyboard::LAYOUT_ARABIC,
1262 MockKeyboard::LAYOUT_CANADIAN_FRENCH, 1260 MockKeyboard::LAYOUT_CANADIAN_FRENCH,
1263 MockKeyboard::LAYOUT_FRENCH, 1261 MockKeyboard::LAYOUT_FRENCH,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 view()->set_send_content_state_immediately(true); 1508 view()->set_send_content_state_immediately(true);
1511 LoadHTML("<html>" 1509 LoadHTML("<html>"
1512 "<head>" 1510 "<head>"
1513 "<title></title>" 1511 "<title></title>"
1514 "</head>" 1512 "</head>"
1515 "<body>" 1513 "<body>"
1516 "<div id='test' contenteditable='true'>" 1514 "<div id='test' contenteditable='true'>"
1517 "</div>" 1515 "</div>"
1518 "</body>" 1516 "</body>"
1519 "</html>"); 1517 "</html>");
1520 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); 1518 ExecuteJavaScript("document.getElementById('test').focus();");
1521 render_thread_->sink().ClearMessages(); 1519 render_thread_->sink().ClearMessages();
1522 1520
1523 // For each key code, we send three keyboard events. 1521 // For each key code, we send three keyboard events.
1524 // * Pressing only the key; 1522 // * Pressing only the key;
1525 // * Pressing the key and a left-shift key, and; 1523 // * Pressing the key and a left-shift key, and;
1526 // * Pressing the key and a right-alt (AltGr) key. 1524 // * Pressing the key and a right-alt (AltGr) key.
1527 static const MockKeyboard::Modifiers kModifiers[] = { 1525 static const MockKeyboard::Modifiers kModifiers[] = {
1528 MockKeyboard::NONE, 1526 MockKeyboard::NONE,
1529 MockKeyboard::LEFT_SHIFT, 1527 MockKeyboard::LEFT_SHIFT,
1530 #if defined(OS_WIN) 1528 #if defined(OS_WIN)
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 #if defined(OS_WIN) 1734 #if defined(OS_WIN)
1737 // http://crbug.com/304193 1735 // http://crbug.com/304193
1738 if (base::win::GetVersion() < base::win::VERSION_VISTA) 1736 if (base::win::GetVersion() < base::win::VERSION_VISTA)
1739 return; 1737 return;
1740 // http://crbug.com/508747 1738 // http://crbug.com/508747
1741 if (base::win::GetVersion() >= base::win::VERSION_WIN10) 1739 if (base::win::GetVersion() >= base::win::VERSION_WIN10)
1742 return; 1740 return;
1743 #endif 1741 #endif
1744 1742
1745 LoadHTML("<textarea id=\"test\"></textarea>"); 1743 LoadHTML("<textarea id=\"test\"></textarea>");
1746 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); 1744 ExecuteJavaScript("document.getElementById('test').focus();");
1747 1745
1748 const base::string16 empty_string; 1746 const base::string16 empty_string;
1749 const std::vector<blink::WebCompositionUnderline> empty_underline; 1747 const std::vector<blink::WebCompositionUnderline> empty_underline;
1750 std::vector<gfx::Rect> bounds; 1748 std::vector<gfx::Rect> bounds;
1751 view()->OnSetFocus(true); 1749 view()->OnSetFocus(true);
1752 1750
1753 // ASCII composition 1751 // ASCII composition
1754 const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo"); 1752 const base::string16 ascii_composition = base::UTF8ToUTF16("aiueo");
1755 view()->OnImeSetComposition(ascii_composition, empty_underline, 0, 0); 1753 view()->OnImeSetComposition(ascii_composition, empty_underline, 0, 0);
1756 view()->GetCompositionCharacterBounds(&bounds); 1754 view()->GetCompositionCharacterBounds(&bounds);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1838 1836
1839 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { 1837 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) {
1840 // Load an HTML page consisting of an input field. 1838 // Load an HTML page consisting of an input field.
1841 LoadHTML("<html>" 1839 LoadHTML("<html>"
1842 "<head>" 1840 "<head>"
1843 "</head>" 1841 "</head>"
1844 "<body>" 1842 "<body>"
1845 "<input id=\"test1\" value=\"some test text hello\"></input>" 1843 "<input id=\"test1\" value=\"some test text hello\"></input>"
1846 "</body>" 1844 "</body>"
1847 "</html>"); 1845 "</html>");
1848 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 1846 ExecuteJavaScript("document.getElementById('test1').focus();");
1849 frame()->SetEditableSelectionOffsets(4, 8); 1847 frame()->SetEditableSelectionOffsets(4, 8);
1850 const std::vector<blink::WebCompositionUnderline> empty_underline; 1848 const std::vector<blink::WebCompositionUnderline> empty_underline;
1851 frame()->SetCompositionFromExistingText(7, 10, empty_underline); 1849 frame()->SetCompositionFromExistingText(7, 10, empty_underline);
1852 blink::WebTextInputInfo info = view()->webview()->textInputInfo(); 1850 blink::WebTextInputInfo info = view()->webview()->textInputInfo();
1853 EXPECT_EQ(4, info.selectionStart); 1851 EXPECT_EQ(4, info.selectionStart);
1854 EXPECT_EQ(8, info.selectionEnd); 1852 EXPECT_EQ(8, info.selectionEnd);
1855 EXPECT_EQ(7, info.compositionStart); 1853 EXPECT_EQ(7, info.compositionStart);
1856 EXPECT_EQ(10, info.compositionEnd); 1854 EXPECT_EQ(10, info.compositionEnd);
1857 frame()->Unselect(); 1855 frame()->Unselect();
1858 info = view()->webview()->textInputInfo(); 1856 info = view()->webview()->textInputInfo();
1859 EXPECT_EQ(0, info.selectionStart); 1857 EXPECT_EQ(0, info.selectionStart);
1860 EXPECT_EQ(0, info.selectionEnd); 1858 EXPECT_EQ(0, info.selectionEnd);
1861 } 1859 }
1862 1860
1863 1861
1864 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) { 1862 TEST_F(RenderViewImplTest, OnExtendSelectionAndDelete) {
1865 // Load an HTML page consisting of an input field. 1863 // Load an HTML page consisting of an input field.
1866 LoadHTML("<html>" 1864 LoadHTML("<html>"
1867 "<head>" 1865 "<head>"
1868 "</head>" 1866 "</head>"
1869 "<body>" 1867 "<body>"
1870 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>" 1868 "<input id=\"test1\" value=\"abcdefghijklmnopqrstuvwxyz\"></input>"
1871 "</body>" 1869 "</body>"
1872 "</html>"); 1870 "</html>");
1873 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 1871 ExecuteJavaScript("document.getElementById('test1').focus();");
1874 frame()->SetEditableSelectionOffsets(10, 10); 1872 frame()->SetEditableSelectionOffsets(10, 10);
1875 frame()->ExtendSelectionAndDelete(3, 4); 1873 frame()->ExtendSelectionAndDelete(3, 4);
1876 blink::WebTextInputInfo info = view()->webview()->textInputInfo(); 1874 blink::WebTextInputInfo info = view()->webview()->textInputInfo();
1877 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value); 1875 EXPECT_EQ("abcdefgopqrstuvwxyz", info.value);
1878 EXPECT_EQ(7, info.selectionStart); 1876 EXPECT_EQ(7, info.selectionStart);
1879 EXPECT_EQ(7, info.selectionEnd); 1877 EXPECT_EQ(7, info.selectionEnd);
1880 frame()->SetEditableSelectionOffsets(4, 8); 1878 frame()->SetEditableSelectionOffsets(4, 8);
1881 frame()->ExtendSelectionAndDelete(2, 5); 1879 frame()->ExtendSelectionAndDelete(2, 5);
1882 info = view()->webview()->textInputInfo(); 1880 info = view()->webview()->textInputInfo();
1883 EXPECT_EQ("abuvwxyz", info.value); 1881 EXPECT_EQ("abuvwxyz", info.value);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 SignedCertificateTimestampIDStatusList())); 1934 SignedCertificateTimestampIDStatusList()));
1937 ssl_status = view()->GetSSLStatusOfFrame(frame); 1935 ssl_status = view()->GetSSLStatusOfFrame(frame);
1938 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status)); 1936 EXPECT_TRUE(net::IsCertStatusError(ssl_status.cert_status));
1939 } 1937 }
1940 1938
1941 TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) { 1939 TEST_F(RenderViewImplTest, MessageOrderInDidChangeSelection) {
1942 view()->set_send_content_state_immediately(true); 1940 view()->set_send_content_state_immediately(true);
1943 LoadHTML("<textarea id=\"test\"></textarea>"); 1941 LoadHTML("<textarea id=\"test\"></textarea>");
1944 1942
1945 view()->handling_input_event_ = true; 1943 view()->handling_input_event_ = true;
1946 ExecuteJavaScriptForTests("document.getElementById('test').focus();"); 1944 ExecuteJavaScript("document.getElementById('test').focus();");
1947 1945
1948 bool is_input_type_called = false; 1946 bool is_input_type_called = false;
1949 bool is_selection_called = false; 1947 bool is_selection_called = false;
1950 size_t last_input_type = 0; 1948 size_t last_input_type = 0;
1951 size_t last_selection = 0; 1949 size_t last_selection = 0;
1952 1950
1953 for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) { 1951 for (size_t i = 0; i < render_thread_->sink().message_count(); ++i) {
1954 const uint32 type = render_thread_->sink().GetMessageAt(i)->type(); 1952 const uint32 type = render_thread_->sink().GetMessageAt(i)->type();
1955 if (type == ViewHostMsg_TextInputTypeChanged::ID) { 1953 if (type == ViewHostMsg_TextInputTypeChanged::ID) {
1956 is_input_type_called = true; 1954 is_input_type_called = true;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
2124 "</head>" 2122 "</head>"
2125 "</html>"); 2123 "</html>");
2126 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 2124 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
2127 ViewHostMsg_UpdateFaviconURL::ID)); 2125 ViewHostMsg_UpdateFaviconURL::ID));
2128 } 2126 }
2129 2127
2130 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) { 2128 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) {
2131 LoadHTML("<input id='test1' value='hello1'></input>" 2129 LoadHTML("<input id='test1' value='hello1'></input>"
2132 "<input id='test2' value='hello2'></input>"); 2130 "<input id='test2' value='hello2'></input>");
2133 2131
2134 ExecuteJavaScriptForTests("document.getElementById('test1').focus();"); 2132 ExecuteJavaScript("document.getElementById('test1').focus();");
2135 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( 2133 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching(
2136 ViewHostMsg_FocusedNodeChanged::ID); 2134 ViewHostMsg_FocusedNodeChanged::ID);
2137 EXPECT_TRUE(msg1); 2135 EXPECT_TRUE(msg1);
2138 2136
2139 ViewHostMsg_FocusedNodeChanged::Param params; 2137 ViewHostMsg_FocusedNodeChanged::Param params;
2140 ViewHostMsg_FocusedNodeChanged::Read(msg1, &params); 2138 ViewHostMsg_FocusedNodeChanged::Read(msg1, &params);
2141 EXPECT_TRUE(base::get<0>(params)); 2139 EXPECT_TRUE(base::get<0>(params));
2142 render_thread_->sink().ClearMessages(); 2140 render_thread_->sink().ClearMessages();
2143 2141
2144 ExecuteJavaScriptForTests("document.getElementById('test2').focus();"); 2142 ExecuteJavaScript("document.getElementById('test2').focus();");
2145 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching( 2143 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching(
2146 ViewHostMsg_FocusedNodeChanged::ID); 2144 ViewHostMsg_FocusedNodeChanged::ID);
2147 EXPECT_TRUE(msg2); 2145 EXPECT_TRUE(msg2);
2148 ViewHostMsg_FocusedNodeChanged::Read(msg2, &params); 2146 ViewHostMsg_FocusedNodeChanged::Read(msg2, &params);
2149 EXPECT_TRUE(base::get<0>(params)); 2147 EXPECT_TRUE(base::get<0>(params));
2150 render_thread_->sink().ClearMessages(); 2148 render_thread_->sink().ClearMessages();
2151 2149
2152 view()->webview()->clearFocusedElement(); 2150 view()->webview()->clearFocusedElement();
2153 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching( 2151 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching(
2154 ViewHostMsg_FocusedNodeChanged::ID); 2152 ViewHostMsg_FocusedNodeChanged::ID);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) { 2347 TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) {
2350 Attach(); 2348 Attach();
2351 EXPECT_FALSE(IsPaused()); 2349 EXPECT_FALSE(IsPaused());
2352 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}"); 2350 DispatchDevToolsMessage("{\"id\":1,\"method\":\"Debugger.enable\"}");
2353 2351
2354 // Executing javascript will pause the thread and create nested message loop. 2352 // Executing javascript will pause the thread and create nested message loop.
2355 // Posting task simulates message coming from browser. 2353 // Posting task simulates message coming from browser.
2356 base::ThreadTaskRunnerHandle::Get()->PostTask( 2354 base::ThreadTaskRunnerHandle::Get()->PostTask(
2357 FROM_HERE, 2355 FROM_HERE,
2358 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2356 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2359 ExecuteJavaScriptForTests("debugger;"); 2357 ExecuteJavaScript("debugger;");
2360 2358
2361 // CloseWhilePaused should resume execution and continue here. 2359 // CloseWhilePaused should resume execution and continue here.
2362 EXPECT_FALSE(IsPaused()); 2360 EXPECT_FALSE(IsPaused());
2363 Detach(); 2361 Detach();
2364 } 2362 }
2365 2363
2366 } // namespace content 2364 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/devtools/v8_sampling_profiler_browsertest.cc ('k') | content/renderer/render_view_browsertest_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698