| 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/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/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 int dst; | 97 int dst; |
| 98 } kModifierMap[] = { | 98 } kModifierMap[] = { |
| 99 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, | 99 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, |
| 100 { MockKeyboard::RIGHT_SHIFT, ui::EF_SHIFT_DOWN }, | 100 { MockKeyboard::RIGHT_SHIFT, ui::EF_SHIFT_DOWN }, |
| 101 { MockKeyboard::LEFT_CONTROL, ui::EF_CONTROL_DOWN }, | 101 { MockKeyboard::LEFT_CONTROL, ui::EF_CONTROL_DOWN }, |
| 102 { MockKeyboard::RIGHT_CONTROL, ui::EF_CONTROL_DOWN }, | 102 { MockKeyboard::RIGHT_CONTROL, ui::EF_CONTROL_DOWN }, |
| 103 { MockKeyboard::LEFT_ALT, ui::EF_ALT_DOWN }, | 103 { MockKeyboard::LEFT_ALT, ui::EF_ALT_DOWN }, |
| 104 { MockKeyboard::RIGHT_ALT, ui::EF_ALT_DOWN }, | 104 { MockKeyboard::RIGHT_ALT, ui::EF_ALT_DOWN }, |
| 105 }; | 105 }; |
| 106 int flags = 0; | 106 int flags = 0; |
| 107 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kModifierMap); ++i) { | 107 for (size_t i = 0; i < arraysize(kModifierMap); ++i) { |
| 108 if (kModifierMap[i].src & modifiers) { | 108 if (kModifierMap[i].src & modifiers) { |
| 109 flags |= kModifierMap[i].dst; | 109 flags |= kModifierMap[i].dst; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 return flags; | 112 return flags; |
| 113 } | 113 } |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 class WebUITestWebUIControllerFactory : public WebUIControllerFactory { | 116 class WebUITestWebUIControllerFactory : public WebUIControllerFactory { |
| 117 public: | 117 public: |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 // to de-activate IMEs. | 996 // to de-activate IMEs. |
| 997 view()->UpdateTextInputType(); | 997 view()->UpdateTextInputType(); |
| 998 msg = render_thread_->sink().GetMessageAt(0); | 998 msg = render_thread_->sink().GetMessageAt(0); |
| 999 EXPECT_TRUE(msg != NULL); | 999 EXPECT_TRUE(msg != NULL); |
| 1000 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); | 1000 EXPECT_EQ(ViewHostMsg_TextInputTypeChanged::ID, msg->type()); |
| 1001 ViewHostMsg_TextInputTypeChanged::Read(msg, & params); | 1001 ViewHostMsg_TextInputTypeChanged::Read(msg, & params); |
| 1002 type = params.a; | 1002 type = params.a; |
| 1003 input_mode = params.b; | 1003 input_mode = params.b; |
| 1004 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type); | 1004 EXPECT_EQ(ui::TEXT_INPUT_TYPE_PASSWORD, type); |
| 1005 | 1005 |
| 1006 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kInputModeTestCases); i++) { | 1006 for (size_t i = 0; i < arraysize(kInputModeTestCases); i++) { |
| 1007 const InputModeTestCase* test_case = &kInputModeTestCases[i]; | 1007 const InputModeTestCase* test_case = &kInputModeTestCases[i]; |
| 1008 std::string javascript = | 1008 std::string javascript = |
| 1009 base::StringPrintf("document.getElementById('%s').focus();", | 1009 base::StringPrintf("document.getElementById('%s').focus();", |
| 1010 test_case->input_id); | 1010 test_case->input_id); |
| 1011 // Move the input focus to the target <input> element, where we should | 1011 // Move the input focus to the target <input> element, where we should |
| 1012 // activate IMEs. | 1012 // activate IMEs. |
| 1013 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL); | 1013 ExecuteJavaScriptAndReturnIntValue(base::ASCIIToUTF16(javascript), NULL); |
| 1014 ProcessPendingMessages(); | 1014 ProcessPendingMessages(); |
| 1015 render_thread_->sink().ClearMessages(); | 1015 render_thread_->sink().ClearMessages(); |
| 1016 | 1016 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 {IME_SETCOMPOSITION, false, 0, 1, L"\xC548", L"\xC548"}, | 1091 {IME_SETCOMPOSITION, false, 0, 1, L"\xC548", L"\xC548"}, |
| 1092 {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548"}, | 1092 {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548"}, |
| 1093 {IME_SETCOMPOSITION, false, 0, 1, L"\x3134", L"\xC548\x3134"}, | 1093 {IME_SETCOMPOSITION, false, 0, 1, L"\x3134", L"\xC548\x3134"}, |
| 1094 {IME_SETCOMPOSITION, false, 0, 1, L"\xB140", L"\xC548\xB140"}, | 1094 {IME_SETCOMPOSITION, false, 0, 1, L"\xB140", L"\xC548\xB140"}, |
| 1095 {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, | 1095 {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, |
| 1096 {IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\xC548"}, | 1096 {IME_CANCELCOMPOSITION, false, -1, -1, L"", L"\xC548"}, |
| 1097 {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, | 1097 {IME_SETCOMPOSITION, false, 0, 1, L"\xB155", L"\xC548\xB155"}, |
| 1098 {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548\xB155"}, | 1098 {IME_CONFIRMCOMPOSITION, false, -1, -1, L"", L"\xC548\xB155"}, |
| 1099 }; | 1099 }; |
| 1100 | 1100 |
| 1101 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kImeMessages); i++) { | 1101 for (size_t i = 0; i < arraysize(kImeMessages); i++) { |
| 1102 const ImeMessage* ime_message = &kImeMessages[i]; | 1102 const ImeMessage* ime_message = &kImeMessages[i]; |
| 1103 switch (ime_message->command) { | 1103 switch (ime_message->command) { |
| 1104 case IME_INITIALIZE: | 1104 case IME_INITIALIZE: |
| 1105 // Load an HTML page consisting of a content-editable <div> element, | 1105 // Load an HTML page consisting of a content-editable <div> element, |
| 1106 // and move the input focus to the <div> element, where we can use | 1106 // and move the input focus to the <div> element, where we can use |
| 1107 // IMEs. | 1107 // IMEs. |
| 1108 view()->OnSetInputMethodActive(ime_message->enable); | 1108 view()->OnSetInputMethodActive(ime_message->enable); |
| 1109 view()->set_send_content_state_immediately(true); | 1109 view()->set_send_content_state_immediately(true); |
| 1110 LoadHTML("<html>" | 1110 LoadHTML("<html>" |
| 1111 "<head>" | 1111 "<head>" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 "</html>"); | 1185 "</html>"); |
| 1186 render_thread_->sink().ClearMessages(); | 1186 render_thread_->sink().ClearMessages(); |
| 1187 | 1187 |
| 1188 static const struct { | 1188 static const struct { |
| 1189 WebTextDirection direction; | 1189 WebTextDirection direction; |
| 1190 const wchar_t* expected_result; | 1190 const wchar_t* expected_result; |
| 1191 } kTextDirection[] = { | 1191 } kTextDirection[] = { |
| 1192 { blink::WebTextDirectionRightToLeft, L"\x000A" L"rtl,rtl" }, | 1192 { blink::WebTextDirectionRightToLeft, L"\x000A" L"rtl,rtl" }, |
| 1193 { blink::WebTextDirectionLeftToRight, L"\x000A" L"ltr,ltr" }, | 1193 { blink::WebTextDirectionLeftToRight, L"\x000A" L"ltr,ltr" }, |
| 1194 }; | 1194 }; |
| 1195 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTextDirection); ++i) { | 1195 for (size_t i = 0; i < arraysize(kTextDirection); ++i) { |
| 1196 // Set the text direction of the <textarea> element. | 1196 // Set the text direction of the <textarea> element. |
| 1197 ExecuteJavaScript("document.getElementById('test').focus();"); | 1197 ExecuteJavaScript("document.getElementById('test').focus();"); |
| 1198 view()->OnSetTextDirection(kTextDirection[i].direction); | 1198 view()->OnSetTextDirection(kTextDirection[i].direction); |
| 1199 | 1199 |
| 1200 // Write the values of its DOM 'dir' attribute and its CSS 'direction' | 1200 // Write the values of its DOM 'dir' attribute and its CSS 'direction' |
| 1201 // property to the <div> element. | 1201 // property to the <div> element. |
| 1202 ExecuteJavaScript("var result = document.getElementById('result');" | 1202 ExecuteJavaScript("var result = document.getElementById('result');" |
| 1203 "var node = document.getElementById('test');" | 1203 "var node = document.getElementById('test');" |
| 1204 "var style = getComputedStyle(node, null);" | 1204 "var style = getComputedStyle(node, null);" |
| 1205 "result.innerText =" | 1205 "result.innerText =" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 // out to avoid the illusion that they work. | 1273 // out to avoid the illusion that they work. |
| 1274 MockKeyboard::LAYOUT_ARABIC, | 1274 MockKeyboard::LAYOUT_ARABIC, |
| 1275 MockKeyboard::LAYOUT_CANADIAN_FRENCH, | 1275 MockKeyboard::LAYOUT_CANADIAN_FRENCH, |
| 1276 MockKeyboard::LAYOUT_FRENCH, | 1276 MockKeyboard::LAYOUT_FRENCH, |
| 1277 MockKeyboard::LAYOUT_HEBREW, | 1277 MockKeyboard::LAYOUT_HEBREW, |
| 1278 MockKeyboard::LAYOUT_RUSSIAN, | 1278 MockKeyboard::LAYOUT_RUSSIAN, |
| 1279 #endif | 1279 #endif |
| 1280 MockKeyboard::LAYOUT_UNITED_STATES, | 1280 MockKeyboard::LAYOUT_UNITED_STATES, |
| 1281 }; | 1281 }; |
| 1282 | 1282 |
| 1283 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kLayouts); ++i) { | 1283 for (size_t i = 0; i < arraysize(kLayouts); ++i) { |
| 1284 // For each key code, we send three keyboard events. | 1284 // For each key code, we send three keyboard events. |
| 1285 // * we press only the key; | 1285 // * we press only the key; |
| 1286 // * we press the key and a left-shift key, and; | 1286 // * we press the key and a left-shift key, and; |
| 1287 // * we press the key and a right-alt (AltGr) key. | 1287 // * we press the key and a right-alt (AltGr) key. |
| 1288 // For each modifiers, we need a string used for formatting its expected | 1288 // For each modifiers, we need a string used for formatting its expected |
| 1289 // result. (See the above comment for its format.) | 1289 // result. (See the above comment for its format.) |
| 1290 static const struct { | 1290 static const struct { |
| 1291 MockKeyboard::Modifiers modifiers; | 1291 MockKeyboard::Modifiers modifiers; |
| 1292 const char* expected_result; | 1292 const char* expected_result; |
| 1293 } kModifierData[] = { | 1293 } kModifierData[] = { |
| 1294 {MockKeyboard::NONE, "false,false,false"}, | 1294 {MockKeyboard::NONE, "false,false,false"}, |
| 1295 {MockKeyboard::LEFT_SHIFT, "true,false,false"}, | 1295 {MockKeyboard::LEFT_SHIFT, "true,false,false"}, |
| 1296 #if defined(OS_WIN) | 1296 #if defined(OS_WIN) |
| 1297 {MockKeyboard::RIGHT_ALT, "false,false,true"}, | 1297 {MockKeyboard::RIGHT_ALT, "false,false,true"}, |
| 1298 #endif | 1298 #endif |
| 1299 }; | 1299 }; |
| 1300 | 1300 |
| 1301 MockKeyboard::Layout layout = kLayouts[i]; | 1301 MockKeyboard::Layout layout = kLayouts[i]; |
| 1302 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifierData); ++j) { | 1302 for (size_t j = 0; j < arraysize(kModifierData); ++j) { |
| 1303 // Virtual key codes used for this test. | 1303 // Virtual key codes used for this test. |
| 1304 static const int kKeyCodes[] = { | 1304 static const int kKeyCodes[] = { |
| 1305 '0', '1', '2', '3', '4', '5', '6', '7', | 1305 '0', '1', '2', '3', '4', '5', '6', '7', |
| 1306 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 1306 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
| 1307 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 1307 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
| 1308 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 1308 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
| 1309 'W', 'X', 'Y', 'Z', | 1309 'W', 'X', 'Y', 'Z', |
| 1310 ui::VKEY_OEM_1, | 1310 ui::VKEY_OEM_1, |
| 1311 ui::VKEY_OEM_PLUS, | 1311 ui::VKEY_OEM_PLUS, |
| 1312 ui::VKEY_OEM_COMMA, | 1312 ui::VKEY_OEM_COMMA, |
| 1313 ui::VKEY_OEM_MINUS, | 1313 ui::VKEY_OEM_MINUS, |
| 1314 ui::VKEY_OEM_PERIOD, | 1314 ui::VKEY_OEM_PERIOD, |
| 1315 ui::VKEY_OEM_2, | 1315 ui::VKEY_OEM_2, |
| 1316 ui::VKEY_OEM_3, | 1316 ui::VKEY_OEM_3, |
| 1317 ui::VKEY_OEM_4, | 1317 ui::VKEY_OEM_4, |
| 1318 ui::VKEY_OEM_5, | 1318 ui::VKEY_OEM_5, |
| 1319 ui::VKEY_OEM_6, | 1319 ui::VKEY_OEM_6, |
| 1320 ui::VKEY_OEM_7, | 1320 ui::VKEY_OEM_7, |
| 1321 #if defined(OS_WIN) | 1321 #if defined(OS_WIN) |
| 1322 // Not sure how to handle this key on Linux. | 1322 // Not sure how to handle this key on Linux. |
| 1323 ui::VKEY_OEM_8, | 1323 ui::VKEY_OEM_8, |
| 1324 #endif | 1324 #endif |
| 1325 }; | 1325 }; |
| 1326 | 1326 |
| 1327 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; | 1327 MockKeyboard::Modifiers modifiers = kModifierData[j].modifiers; |
| 1328 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 1328 for (size_t k = 0; k < arraysize(kKeyCodes); ++k) { |
| 1329 // Send a keyboard event to the RenderView object. | 1329 // Send a keyboard event to the RenderView object. |
| 1330 // We should test a keyboard event only when the given keyboard-layout | 1330 // We should test a keyboard event only when the given keyboard-layout |
| 1331 // driver is installed in a PC and the driver can assign a Unicode | 1331 // driver is installed in a PC and the driver can assign a Unicode |
| 1332 // charcter for the given tuple (key-code and modifiers). | 1332 // charcter for the given tuple (key-code and modifiers). |
| 1333 int key_code = kKeyCodes[k]; | 1333 int key_code = kKeyCodes[k]; |
| 1334 base::string16 char_code; | 1334 base::string16 char_code; |
| 1335 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) | 1335 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) |
| 1336 continue; | 1336 continue; |
| 1337 | 1337 |
| 1338 // Create an expected result from the virtual-key code, the character | 1338 // Create an expected result from the virtual-key code, the character |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" | 1508 L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" |
| 1509 L"\x0038\x0039\x0061\x0062\x0063\x0064\x0065\x0066" | 1509 L"\x0038\x0039\x0061\x0062\x0063\x0064\x0065\x0066" |
| 1510 L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" | 1510 L"\x0067\x0068\x0069\x006a\x006b\x006c\x006d\x006e" |
| 1511 L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" | 1511 L"\x006f\x0070\x0071\x0072\x0073\x0074\x0075\x0076" |
| 1512 L"\x0077\x0078\x0079\x007a\x003b\x003d\x002c\x002d" | 1512 L"\x0077\x0078\x0079\x007a\x003b\x003d\x002c\x002d" |
| 1513 L"\x002e\x002f\x0060\x005b\x005c\x005d\x0027" | 1513 L"\x002e\x002f\x0060\x005b\x005c\x005d\x0027" |
| 1514 #endif | 1514 #endif |
| 1515 }, | 1515 }, |
| 1516 }; | 1516 }; |
| 1517 | 1517 |
| 1518 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kLayouts); ++i) { | 1518 for (size_t i = 0; i < arraysize(kLayouts); ++i) { |
| 1519 // Load an HTML page consisting of one <div> element. | 1519 // Load an HTML page consisting of one <div> element. |
| 1520 // This <div> element is used by the EditorClientImpl class to insert | 1520 // This <div> element is used by the EditorClientImpl class to insert |
| 1521 // characters received through the RenderWidget::OnHandleInputEvent() | 1521 // characters received through the RenderWidget::OnHandleInputEvent() |
| 1522 // function. | 1522 // function. |
| 1523 view()->set_send_content_state_immediately(true); | 1523 view()->set_send_content_state_immediately(true); |
| 1524 LoadHTML("<html>" | 1524 LoadHTML("<html>" |
| 1525 "<head>" | 1525 "<head>" |
| 1526 "<title></title>" | 1526 "<title></title>" |
| 1527 "</head>" | 1527 "</head>" |
| 1528 "<body>" | 1528 "<body>" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1539 // * Pressing the key and a right-alt (AltGr) key. | 1539 // * Pressing the key and a right-alt (AltGr) key. |
| 1540 static const MockKeyboard::Modifiers kModifiers[] = { | 1540 static const MockKeyboard::Modifiers kModifiers[] = { |
| 1541 MockKeyboard::NONE, | 1541 MockKeyboard::NONE, |
| 1542 MockKeyboard::LEFT_SHIFT, | 1542 MockKeyboard::LEFT_SHIFT, |
| 1543 #if defined(OS_WIN) | 1543 #if defined(OS_WIN) |
| 1544 MockKeyboard::RIGHT_ALT, | 1544 MockKeyboard::RIGHT_ALT, |
| 1545 #endif | 1545 #endif |
| 1546 }; | 1546 }; |
| 1547 | 1547 |
| 1548 MockKeyboard::Layout layout = kLayouts[i].layout; | 1548 MockKeyboard::Layout layout = kLayouts[i].layout; |
| 1549 for (size_t j = 0; j < ARRAYSIZE_UNSAFE(kModifiers); ++j) { | 1549 for (size_t j = 0; j < arraysize(kModifiers); ++j) { |
| 1550 // Virtual key codes used for this test. | 1550 // Virtual key codes used for this test. |
| 1551 static const int kKeyCodes[] = { | 1551 static const int kKeyCodes[] = { |
| 1552 '0', '1', '2', '3', '4', '5', '6', '7', | 1552 '0', '1', '2', '3', '4', '5', '6', '7', |
| 1553 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', | 1553 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', |
| 1554 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', | 1554 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', |
| 1555 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', | 1555 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', |
| 1556 'W', 'X', 'Y', 'Z', | 1556 'W', 'X', 'Y', 'Z', |
| 1557 ui::VKEY_OEM_1, | 1557 ui::VKEY_OEM_1, |
| 1558 ui::VKEY_OEM_PLUS, | 1558 ui::VKEY_OEM_PLUS, |
| 1559 ui::VKEY_OEM_COMMA, | 1559 ui::VKEY_OEM_COMMA, |
| 1560 ui::VKEY_OEM_MINUS, | 1560 ui::VKEY_OEM_MINUS, |
| 1561 ui::VKEY_OEM_PERIOD, | 1561 ui::VKEY_OEM_PERIOD, |
| 1562 ui::VKEY_OEM_2, | 1562 ui::VKEY_OEM_2, |
| 1563 ui::VKEY_OEM_3, | 1563 ui::VKEY_OEM_3, |
| 1564 ui::VKEY_OEM_4, | 1564 ui::VKEY_OEM_4, |
| 1565 ui::VKEY_OEM_5, | 1565 ui::VKEY_OEM_5, |
| 1566 ui::VKEY_OEM_6, | 1566 ui::VKEY_OEM_6, |
| 1567 ui::VKEY_OEM_7, | 1567 ui::VKEY_OEM_7, |
| 1568 #if defined(OS_WIN) | 1568 #if defined(OS_WIN) |
| 1569 // Unclear how to handle this on Linux. | 1569 // Unclear how to handle this on Linux. |
| 1570 ui::VKEY_OEM_8, | 1570 ui::VKEY_OEM_8, |
| 1571 #endif | 1571 #endif |
| 1572 }; | 1572 }; |
| 1573 | 1573 |
| 1574 MockKeyboard::Modifiers modifiers = kModifiers[j]; | 1574 MockKeyboard::Modifiers modifiers = kModifiers[j]; |
| 1575 for (size_t k = 0; k < ARRAYSIZE_UNSAFE(kKeyCodes); ++k) { | 1575 for (size_t k = 0; k < arraysize(kKeyCodes); ++k) { |
| 1576 // Send a keyboard event to the RenderView object. | 1576 // Send a keyboard event to the RenderView object. |
| 1577 // We should test a keyboard event only when the given keyboard-layout | 1577 // We should test a keyboard event only when the given keyboard-layout |
| 1578 // driver is installed in a PC and the driver can assign a Unicode | 1578 // driver is installed in a PC and the driver can assign a Unicode |
| 1579 // charcter for the given tuple (layout, key-code, and modifiers). | 1579 // charcter for the given tuple (layout, key-code, and modifiers). |
| 1580 int key_code = kKeyCodes[k]; | 1580 int key_code = kKeyCodes[k]; |
| 1581 base::string16 char_code; | 1581 base::string16 char_code; |
| 1582 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) | 1582 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) |
| 1583 continue; | 1583 continue; |
| 1584 } | 1584 } |
| 1585 } | 1585 } |
| (...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 ProcessPendingMessages(); | 2501 ProcessPendingMessages(); |
| 2502 base::Time after_navigation = | 2502 base::Time after_navigation = |
| 2503 base::Time::Now() + base::TimeDelta::FromDays(1); | 2503 base::Time::Now() + base::TimeDelta::FromDays(1); |
| 2504 | 2504 |
| 2505 base::Time late_nav_reported_start = | 2505 base::Time late_nav_reported_start = |
| 2506 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2506 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2507 EXPECT_LE(late_nav_reported_start, after_navigation); | 2507 EXPECT_LE(late_nav_reported_start, after_navigation); |
| 2508 } | 2508 } |
| 2509 | 2509 |
| 2510 } // namespace content | 2510 } // namespace content |
| OLD | NEW |