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

Side by Side Diff: Source/web/tests/PopupMenuTest.cpp

Issue 23728003: Return Frame&, not Frame* from RenderView::frame() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed PopupMenuTest build Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/WebPluginContainerImpl.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 EXPECT_EQ(2, selectedIndex()); 400 EXPECT_EQ(2, selectedIndex());
401 } 401 }
402 402
403 TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) 403 TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire)
404 { 404 {
405 registerMockedURLLoad("select_event.html"); 405 registerMockedURLLoad("select_event.html");
406 m_webView->settings()->setJavaScriptEnabled(true); 406 m_webView->settings()->setJavaScriptEnabled(true);
407 loadFrame(m_webView->mainFrame(), "select_event.html"); 407 loadFrame(m_webView->mainFrame(), "select_event.html");
408 serveRequests(); 408 serveRequests();
409 409
410 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame()->document()->focusedElement()); 410 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame().document()->focusedElement());
411 411
412 showPopup(); 412 showPopup();
413 413
414 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 414 int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
415 // menuItemHeight * 0.5 means the Y position on the item at index 0. 415 // menuItemHeight * 0.5 means the Y position on the item at index 0.
416 IntPoint row1Point(2, menuItemHeight * 0.5); 416 IntPoint row1Point(2, menuItemHeight * 0.5);
417 simulateLeftMouseDownEvent(row1Point); 417 simulateLeftMouseDownEvent(row1Point);
418 simulateLeftMouseUpEvent(row1Point); 418 simulateLeftMouseUpEvent(row1Point);
419 419
420 WebElement element = m_webView->mainFrame()->document().getElementById("mess age"); 420 WebElement element = m_webView->mainFrame()->document().getElementById("mess age");
(...skipping 24 matching lines...) Expand all
445 EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data()); 445 EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data());
446 } 446 }
447 447
448 TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) 448 TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent)
449 { 449 {
450 registerMockedURLLoad("select_event.html"); 450 registerMockedURLLoad("select_event.html");
451 m_webView->settings()->setJavaScriptEnabled(true); 451 m_webView->settings()->setJavaScriptEnabled(true);
452 loadFrame(m_webView->mainFrame(), "select_event.html"); 452 loadFrame(m_webView->mainFrame(), "select_event.html");
453 serveRequests(); 453 serveRequests();
454 454
455 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame()->document()->focusedElement()); 455 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame().document()->focusedElement());
456 456
457 showPopup(); 457 showPopup();
458 458
459 // Siumulate to choose the item at index 1 with keyboard. 459 // Siumulate to choose the item at index 1 with keyboard.
460 simulateKeyDownEvent(VKEY_DOWN); 460 simulateKeyDownEvent(VKEY_DOWN);
461 simulateKeyDownEvent(VKEY_DOWN); 461 simulateKeyDownEvent(VKEY_DOWN);
462 simulateKeyDownEvent(VKEY_RETURN); 462 simulateKeyDownEvent(VKEY_RETURN);
463 463
464 WebElement element = m_webView->mainFrame()->document().getElementById("mess age"); 464 WebElement element = m_webView->mainFrame()->document().getElementById("mess age");
465 // We only can see change event but no other mouse related events. 465 // We only can see change event but no other mouse related events.
466 EXPECT_STREQ("change", element.innerText().utf8().data()); 466 EXPECT_STREQ("change", element.innerText().utf8().data());
467 } 467 }
468 468
469 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) 469 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange)
470 { 470 {
471 // Make sure no crash, even if select node is removed on 'change' event hand ler. 471 // Make sure no crash, even if select node is removed on 'change' event hand ler.
472 registerMockedURLLoad("select_event_remove_on_change.html"); 472 registerMockedURLLoad("select_event_remove_on_change.html");
473 m_webView->settings()->setJavaScriptEnabled(true); 473 m_webView->settings()->setJavaScriptEnabled(true);
474 loadFrame(m_webView->mainFrame(), "select_event_remove_on_change.html"); 474 loadFrame(m_webView->mainFrame(), "select_event_remove_on_change.html");
475 serveRequests(); 475 serveRequests();
476 476
477 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame()->document()->focusedElement()); 477 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame().document()->focusedElement());
478 478
479 showPopup(); 479 showPopup();
480 480
481 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 481 int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
482 // menuItemHeight * 1.5 means the Y position on the item at index 1. 482 // menuItemHeight * 1.5 means the Y position on the item at index 1.
483 IntPoint row1Point(2, menuItemHeight * 1.5); 483 IntPoint row1Point(2, menuItemHeight * 1.5);
484 simulateLeftMouseDownEvent(row1Point); 484 simulateLeftMouseDownEvent(row1Point);
485 simulateLeftMouseUpEvent(row1Point); 485 simulateLeftMouseUpEvent(row1Point);
486 486
487 WebElement element = m_webView->mainFrame()->document().getElementById("mess age"); 487 WebElement element = m_webView->mainFrame()->document().getElementById("mess age");
488 EXPECT_STREQ("change", element.innerText().utf8().data()); 488 EXPECT_STREQ("change", element.innerText().utf8().data());
489 } 489 }
490 490
491 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) 491 TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick)
492 { 492 {
493 // Make sure no crash, even if select node is removed on 'click' event handl er. 493 // Make sure no crash, even if select node is removed on 'click' event handl er.
494 registerMockedURLLoad("select_event_remove_on_click.html"); 494 registerMockedURLLoad("select_event_remove_on_click.html");
495 m_webView->settings()->setJavaScriptEnabled(true); 495 m_webView->settings()->setJavaScriptEnabled(true);
496 loadFrame(m_webView->mainFrame(), "select_event_remove_on_click.html"); 496 loadFrame(m_webView->mainFrame(), "select_event_remove_on_click.html");
497 serveRequests(); 497 serveRequests();
498 498
499 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame()->document()->focusedElement()); 499 m_popupMenuClient.setFocusedNode(toWebFrameImpl(m_webView->mainFrame())->fra meView()->frame().document()->focusedElement());
500 500
501 showPopup(); 501 showPopup();
502 502
503 int menuItemHeight = m_webView->selectPopup()->menuItemHeight(); 503 int menuItemHeight = m_webView->selectPopup()->menuItemHeight();
504 // menuItemHeight * 1.5 means the Y position on the item at index 1. 504 // menuItemHeight * 1.5 means the Y position on the item at index 1.
505 IntPoint row1Point(2, menuItemHeight * 1.5); 505 IntPoint row1Point(2, menuItemHeight * 1.5);
506 simulateLeftMouseDownEvent(row1Point); 506 simulateLeftMouseDownEvent(row1Point);
507 simulateLeftMouseUpEvent(row1Point); 507 simulateLeftMouseUpEvent(row1Point);
508 508
509 WebElement element = m_webView->mainFrame()->document().getElementById("mess age"); 509 WebElement element = m_webView->mainFrame()->document().getElementById("mess age");
510 EXPECT_STREQ("click", element.innerText().utf8().data()); 510 EXPECT_STREQ("click", element.innerText().utf8().data());
511 } 511 }
512 512
513 } // namespace 513 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebPluginContainerImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698