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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/test/render_view_test.h" | 10 #include "chrome/test/render_view_test.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 const int kMaxOutputCharacters = 16; | 369 const int kMaxOutputCharacters = 16; |
370 std::wstring output = UTF16ToWideHack( | 370 std::wstring output = UTF16ToWideHack( |
371 GetMainFrame()->contentAsText(kMaxOutputCharacters)); | 371 GetMainFrame()->contentAsText(kMaxOutputCharacters)); |
372 EXPECT_EQ(output, kTextDirection[i].expected_result); | 372 EXPECT_EQ(output, kTextDirection[i].expected_result); |
373 } | 373 } |
374 } | 374 } |
375 | 375 |
376 // Test that we can receive correct DOM events when we send input events | 376 // Test that we can receive correct DOM events when we send input events |
377 // through the RenderWidget::OnHandleInputEvent() function. | 377 // through the RenderWidget::OnHandleInputEvent() function. |
378 TEST_F(RenderViewTest, OnHandleKeyboardEvent) { | 378 TEST_F(RenderViewTest, OnHandleKeyboardEvent) { |
379 #if defined(OS_WIN) || defined(OS_LINUX) | 379 #if !defined(OS_MACOSX) |
380 // Load an HTML page consisting of one <input> element and three | 380 // Load an HTML page consisting of one <input> element and three |
381 // contentediable <div> elements. | 381 // contentediable <div> elements. |
382 // The <input> element is used for sending keyboard events, and the <div> | 382 // The <input> element is used for sending keyboard events, and the <div> |
383 // elements are used for writing DOM events in the following format: | 383 // elements are used for writing DOM events in the following format: |
384 // "<keyCode>,<shiftKey>,<controlKey>,<altKey>". | 384 // "<keyCode>,<shiftKey>,<controlKey>,<altKey>". |
385 // TODO(hbono): <http://crbug.com/2215> Our WebKit port set |ev.metaKey| to | 385 // TODO(hbono): <http://crbug.com/2215> Our WebKit port set |ev.metaKey| to |
386 // true when pressing an alt key, i.e. the |ev.metaKey| value is not | 386 // true when pressing an alt key, i.e. the |ev.metaKey| value is not |
387 // trustworthy. We will check the |ev.metaKey| value when this issue is fixed. | 387 // trustworthy. We will check the |ev.metaKey| value when this issue is fixed. |
388 view_->set_send_content_state_immediately(true); | 388 view_->set_send_content_state_immediately(true); |
389 LoadHTML("<html>" | 389 LoadHTML("<html>" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 #else | 517 #else |
518 NOTIMPLEMENTED(); | 518 NOTIMPLEMENTED(); |
519 #endif | 519 #endif |
520 } | 520 } |
521 | 521 |
522 // Test that our EditorClientImpl class can insert characters when we send | 522 // Test that our EditorClientImpl class can insert characters when we send |
523 // keyboard events through the RenderWidget::OnHandleInputEvent() function. | 523 // keyboard events through the RenderWidget::OnHandleInputEvent() function. |
524 // This test is for preventing regressions caused only when we use non-US | 524 // This test is for preventing regressions caused only when we use non-US |
525 // keyboards, such as Issue 10846. | 525 // keyboards, such as Issue 10846. |
526 TEST_F(RenderViewTest, InsertCharacters) { | 526 TEST_F(RenderViewTest, InsertCharacters) { |
527 #if defined(OS_WIN) || defined(OS_LINUX) | 527 #if !defined(OS_MACOSX) |
528 static const struct { | 528 static const struct { |
529 MockKeyboard::Layout layout; | 529 MockKeyboard::Layout layout; |
530 const wchar_t* expected_result; | 530 const wchar_t* expected_result; |
531 } kLayouts[] = { | 531 } kLayouts[] = { |
532 #if 0 | 532 #if 0 |
533 // Disabled these keyboard layouts because buildbots do not have their | 533 // Disabled these keyboard layouts because buildbots do not have their |
534 // keyboard-layout drivers installed. | 534 // keyboard-layout drivers installed. |
535 {MockKeyboard::LAYOUT_ARABIC, | 535 {MockKeyboard::LAYOUT_ARABIC, |
536 L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" | 536 L"\x0030\x0031\x0032\x0033\x0034\x0035\x0036\x0037" |
537 L"\x0038\x0039\x0634\x0624\x064a\x062b\x0628\x0644" | 537 L"\x0038\x0039\x0634\x0624\x064a\x062b\x0628\x0644" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 // Frame should stay in view-source mode. | 769 // Frame should stay in view-source mode. |
770 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); | 770 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); |
771 } | 771 } |
772 | 772 |
773 // Regression test for http://crbug.com/41562 | 773 // Regression test for http://crbug.com/41562 |
774 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { | 774 TEST_F(RenderViewTest, UpdateTargetURLWithInvalidURL) { |
775 const GURL invalid_gurl("http://"); | 775 const GURL invalid_gurl("http://"); |
776 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl)); | 776 view_->setMouseOverURL(WebKit::WebURL(invalid_gurl)); |
777 EXPECT_EQ(invalid_gurl, view_->target_url_); | 777 EXPECT_EQ(invalid_gurl, view_->target_url_); |
778 } | 778 } |
OLD | NEW |