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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2139303002: Clean up around methods to enter/exit fullscreen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 /* 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 6452 matching lines...) Expand 10 before | Expand all | Expand 10 after
6463 client.m_screenInfo.rect.width = viewportWidth; 6463 client.m_screenInfo.rect.width = viewportWidth;
6464 client.m_screenInfo.rect.height = viewportHeight; 6464 client.m_screenInfo.rect.height = viewportHeight;
6465 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid); 6465 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid);
6466 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6466 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6467 webViewImpl->updateAllLifecyclePhases(); 6467 webViewImpl->updateAllLifecyclePhases();
6468 6468
6469 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6469 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6470 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6470 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6471 Element* divFullscreen = document->getElementById("div1"); 6471 Element* divFullscreen = document->getElementById("div1");
6472 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6472 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6473 webViewImpl->didEnterFullScreen(); 6473 webViewImpl->didEnterFullscreen();
6474 webViewImpl->updateAllLifecyclePhases(); 6474 webViewImpl->updateAllLifecyclePhases();
6475 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6475 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6476 6476
6477 // Verify that the element is sized to the viewport. 6477 // Verify that the element is sized to the viewport.
6478 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject(); 6478 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6479 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6479 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6480 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6480 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6481 6481
6482 // Verify it's updated after a device rotation. 6482 // Verify it's updated after a device rotation.
6483 client.m_screenInfo.rect.width = viewportHeight; 6483 client.m_screenInfo.rect.width = viewportHeight;
(...skipping 12 matching lines...) Expand all
6496 int viewportWidth = 640; 6496 int viewportWidth = 640;
6497 int viewportHeight = 480; 6497 int viewportHeight = 480;
6498 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid); 6498 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid);
6499 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6499 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6500 webViewImpl->updateAllLifecyclePhases(); 6500 webViewImpl->updateAllLifecyclePhases();
6501 6501
6502 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6502 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6503 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6503 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6504 Element* divFullscreen = document->getElementById("div1"); 6504 Element* divFullscreen = document->getElementById("div1");
6505 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6505 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6506 webViewImpl->didEnterFullScreen(); 6506 webViewImpl->didEnterFullscreen();
6507 webViewImpl->updateAllLifecyclePhases(); 6507 webViewImpl->updateAllLifecyclePhases();
6508 6508
6509 // Verify that the viewports are nonscrollable. 6509 // Verify that the viewports are nonscrollable.
6510 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6510 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6511 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew(); 6511 FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl()->frameVi ew();
6512 WebLayer* layoutViewportScrollLayer = webViewImpl->compositor()->scrollLayer ()->platformLayer(); 6512 WebLayer* layoutViewportScrollLayer = webViewImpl->compositor()->scrollLayer ()->platformLayer();
6513 WebLayer* visualViewportScrollLayer = frameView->page()->frameHost().visualV iewport().scrollLayer()->platformLayer(); 6513 WebLayer* visualViewportScrollLayer = frameView->page()->frameHost().visualV iewport().scrollLayer()->platformLayer();
6514 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal()); 6514 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableHorizontal());
6515 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical()); 6515 ASSERT_FALSE(layoutViewportScrollLayer->userScrollableVertical());
6516 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal()); 6516 ASSERT_FALSE(visualViewportScrollLayer->userScrollableHorizontal());
6517 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical()); 6517 ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical());
6518 6518
6519 // Verify that the viewports are scrollable upon exiting fullscreen. 6519 // Verify that the viewports are scrollable upon exiting fullscreen.
6520 webViewImpl->didExitFullScreen(); 6520 webViewImpl->didExitFullscreen();
6521 webViewImpl->updateAllLifecyclePhases(); 6521 webViewImpl->updateAllLifecyclePhases();
6522 ASSERT_FALSE(Fullscreen::isFullScreen(*document)); 6522 ASSERT_FALSE(Fullscreen::isFullScreen(*document));
6523 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal()); 6523 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal());
6524 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical()); 6524 ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical());
6525 ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal()); 6525 ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal());
6526 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical()); 6526 ASSERT_TRUE(visualViewportScrollLayer->userScrollableVertical());
6527 } 6527 }
6528 6528
6529 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) 6529 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame)
6530 { 6530 {
6531 FakeCompositingWebViewClient client; 6531 FakeCompositingWebViewClient client;
6532 registerMockedHttpURLLoad("fullscreen_div.html"); 6532 registerMockedHttpURLLoad("fullscreen_div.html");
6533 FrameTestHelpers::WebViewHelper webViewHelper(this); 6533 FrameTestHelpers::WebViewHelper webViewHelper(this);
6534 int viewportWidth = 640; 6534 int viewportWidth = 640;
6535 int viewportHeight = 480; 6535 int viewportHeight = 480;
6536 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid); 6536 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, nullptr, &client, nullptr, configureAndroid);
6537 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6537 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6538 webViewImpl->updateAllLifecyclePhases(); 6538 webViewImpl->updateAllLifecyclePhases();
6539 6539
6540 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6540 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6541 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6541 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6542 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); 6542 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest);
6543 webViewImpl->didEnterFullScreen(); 6543 webViewImpl->didEnterFullscreen();
6544 webViewImpl->updateAllLifecyclePhases(); 6544 webViewImpl->updateAllLifecyclePhases();
6545 6545
6546 // Verify that the main frame is still scrollable. 6546 // Verify that the main frame is still scrollable.
6547 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6547 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6548 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor mLayer(); 6548 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor mLayer();
6549 ASSERT_TRUE(webScrollLayer->scrollable()); 6549 ASSERT_TRUE(webScrollLayer->scrollable());
6550 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); 6550 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
6551 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); 6551 ASSERT_TRUE(webScrollLayer->userScrollableVertical());
6552 6552
6553 // Verify the main frame still behaves correctly after a resize. 6553 // Verify the main frame still behaves correctly after a resize.
(...skipping 14 matching lines...) Expand all
6568 int viewportHeight = 480; 6568 int viewportHeight = 480;
6569 client.m_screenInfo.rect.width = viewportWidth; 6569 client.m_screenInfo.rect.width = viewportWidth;
6570 client.m_screenInfo.rect.height = viewportHeight; 6570 client.m_screenInfo.rect.height = viewportHeight;
6571 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6571 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6572 webViewImpl->updateAllLifecyclePhases(); 6572 webViewImpl->updateAllLifecyclePhases();
6573 6573
6574 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document(); 6574 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document();
6575 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6575 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6576 Element* divFullscreen = document->getElementById("div1"); 6576 Element* divFullscreen = document->getElementById("div1");
6577 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest); 6577 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6578 webViewImpl->didEnterFullScreen(); 6578 webViewImpl->didEnterFullscreen();
6579 webViewImpl->updateAllLifecyclePhases(); 6579 webViewImpl->updateAllLifecyclePhases();
6580 6580
6581 // Verify that the element is sized to the viewport. 6581 // Verify that the element is sized to the viewport.
6582 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject(); 6582 LayoutFullScreen* fullscreenLayoutObject = Fullscreen::from(*document).fullS creenLayoutObject();
6583 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt()); 6583 EXPECT_EQ(viewportWidth, fullscreenLayoutObject->logicalWidth().toInt());
6584 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt()); 6584 EXPECT_EQ(viewportHeight, fullscreenLayoutObject->logicalHeight().toInt());
6585 6585
6586 // Verify it's updated after a device rotation. 6586 // Verify it's updated after a device rotation.
6587 client.m_screenInfo.rect.width = viewportHeight; 6587 client.m_screenInfo.rect.width = viewportHeight;
6588 client.m_screenInfo.rect.height = viewportWidth; 6588 client.m_screenInfo.rect.height = viewportWidth;
(...skipping 19 matching lines...) Expand all
6608 LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView()->layoutViewItem(); 6608 LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView()->layoutViewItem();
6609 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor()); 6609 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor());
6610 EXPECT_EQ(533, layoutViewItem.logicalHeight().floor()); 6610 EXPECT_EQ(533, layoutViewItem.logicalHeight().floor());
6611 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor()); 6611 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor());
6612 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor()); 6612 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor());
6613 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6613 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
6614 6614
6615 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6615 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6616 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6616 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6617 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); 6617 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest);
6618 webViewImpl->didEnterFullScreen(); 6618 webViewImpl->didEnterFullscreen();
6619 webViewImpl->updateAllLifecyclePhases(); 6619 webViewImpl->updateAllLifecyclePhases();
6620 EXPECT_EQ(384, layoutViewItem.logicalWidth().floor()); 6620 EXPECT_EQ(384, layoutViewItem.logicalWidth().floor());
6621 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor()); 6621 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor());
6622 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6622 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6623 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6623 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6624 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor()); 6624 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
6625 6625
6626 webViewImpl->didExitFullScreen(); 6626 webViewImpl->didExitFullscreen();
6627 webViewImpl->updateAllLifecyclePhases(); 6627 webViewImpl->updateAllLifecyclePhases();
6628 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor()); 6628 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor());
6629 EXPECT_EQ(533, layoutViewItem.logicalHeight().floor()); 6629 EXPECT_EQ(533, layoutViewItem.logicalHeight().floor());
6630 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor()); 6630 EXPECT_FLOAT_EQ(1.2, webViewImpl->pageScaleFactor());
6631 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor()); 6631 EXPECT_FLOAT_EQ(1.2, webViewImpl->minimumPageScaleFactor());
6632 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6632 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
6633 } 6633 }
6634 6634
6635 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) 6635 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport)
6636 { 6636 {
6637 FakeCompositingWebViewClient client; 6637 FakeCompositingWebViewClient client;
6638 registerMockedHttpURLLoad("viewport-tiny.html"); 6638 registerMockedHttpURLLoad("viewport-tiny.html");
6639 FrameTestHelpers::WebViewHelper webViewHelper(this); 6639 FrameTestHelpers::WebViewHelper webViewHelper(this);
6640 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view port-tiny.html", true, nullptr, &client, nullptr, configureAndroid); 6640 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "view port-tiny.html", true, nullptr, &client, nullptr, configureAndroid);
6641 int viewportWidth = 384; 6641 int viewportWidth = 384;
6642 int viewportHeight = 640; 6642 int viewportHeight = 640;
6643 client.m_screenInfo.rect.width = viewportWidth; 6643 client.m_screenInfo.rect.width = viewportWidth;
6644 client.m_screenInfo.rect.height = viewportHeight; 6644 client.m_screenInfo.rect.height = viewportHeight;
6645 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6645 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6646 webViewImpl->updateAllLifecyclePhases(); 6646 webViewImpl->updateAllLifecyclePhases();
6647 6647
6648 LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView()->layoutViewItem(); 6648 LayoutViewItem layoutViewItem = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView()->layoutViewItem();
6649 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document(); 6649 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()- >document();
6650 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6650 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6651 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest); 6651 Fullscreen::from(*document).requestFullscreen(*document->documentElement(), Fullscreen::PrefixedRequest);
6652 webViewImpl->didEnterFullScreen(); 6652 webViewImpl->didEnterFullscreen();
6653 webViewImpl->updateAllLifecyclePhases(); 6653 webViewImpl->updateAllLifecyclePhases();
6654 EXPECT_EQ(384, layoutViewItem.logicalWidth().floor()); 6654 EXPECT_EQ(384, layoutViewItem.logicalWidth().floor());
6655 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor()); 6655 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor());
6656 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6656 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6657 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6657 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6658 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor()); 6658 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
6659 6659
6660 viewportWidth = 640; 6660 viewportWidth = 640;
6661 viewportHeight = 384; 6661 viewportHeight = 384;
6662 client.m_screenInfo.rect.width = viewportWidth; 6662 client.m_screenInfo.rect.width = viewportWidth;
6663 client.m_screenInfo.rect.height = viewportHeight; 6663 client.m_screenInfo.rect.height = viewportHeight;
6664 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 6664 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
6665 webViewImpl->updateAllLifecyclePhases(); 6665 webViewImpl->updateAllLifecyclePhases();
6666 EXPECT_EQ(640, layoutViewItem.logicalWidth().floor()); 6666 EXPECT_EQ(640, layoutViewItem.logicalWidth().floor());
6667 EXPECT_EQ(384, layoutViewItem.logicalHeight().floor()); 6667 EXPECT_EQ(384, layoutViewItem.logicalHeight().floor());
6668 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6668 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6669 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6669 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6670 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor()); 6670 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
6671 6671
6672 webViewImpl->didExitFullScreen(); 6672 webViewImpl->didExitFullscreen();
6673 webViewImpl->updateAllLifecyclePhases(); 6673 webViewImpl->updateAllLifecyclePhases();
6674 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor()); 6674 EXPECT_EQ(320, layoutViewItem.logicalWidth().floor());
6675 EXPECT_EQ(192, layoutViewItem.logicalHeight().floor()); 6675 EXPECT_EQ(192, layoutViewItem.logicalHeight().floor());
6676 EXPECT_FLOAT_EQ(2, webViewImpl->pageScaleFactor()); 6676 EXPECT_FLOAT_EQ(2, webViewImpl->pageScaleFactor());
6677 EXPECT_FLOAT_EQ(2, webViewImpl->minimumPageScaleFactor()); 6677 EXPECT_FLOAT_EQ(2, webViewImpl->minimumPageScaleFactor());
6678 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6678 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
6679 } 6679 }
6680 6680
6681 TEST_P(ParameterizedWebFrameTest, FullscreenRestoreScaleFactorUponExiting) 6681 TEST_P(ParameterizedWebFrameTest, FullscreenRestoreScaleFactorUponExiting)
6682 { 6682 {
(...skipping 18 matching lines...) Expand all
6701 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6701 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6702 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6702 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6703 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6703 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
6704 6704
6705 { 6705 {
6706 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->fram e()->document(); 6706 Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->fram e()->document();
6707 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6707 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6708 Fullscreen::from(*document).requestFullscreen(*document->body(), Fullscr een::PrefixedRequest); 6708 Fullscreen::from(*document).requestFullscreen(*document->body(), Fullscr een::PrefixedRequest);
6709 } 6709 }
6710 6710
6711 webViewImpl->didEnterFullScreen(); 6711 webViewImpl->didEnterFullscreen();
6712 webViewImpl->updateAllLifecyclePhases(); 6712 webViewImpl->updateAllLifecyclePhases();
6713 client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width; 6713 client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width;
6714 client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height; 6714 client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height;
6715 webViewHelper.resize(screenSizeMinusStatusBars); 6715 webViewHelper.resize(screenSizeMinusStatusBars);
6716 client.m_screenInfo.rect.width = screenSize.width; 6716 client.m_screenInfo.rect.width = screenSize.width;
6717 client.m_screenInfo.rect.height = screenSize.height; 6717 client.m_screenInfo.rect.height = screenSize.height;
6718 webViewHelper.resize(screenSize); 6718 webViewHelper.resize(screenSize);
6719 EXPECT_EQ(screenSize.width, layoutViewItem.logicalWidth().floor()); 6719 EXPECT_EQ(screenSize.width, layoutViewItem.logicalWidth().floor());
6720 EXPECT_EQ(screenSize.height, layoutViewItem.logicalHeight().floor()); 6720 EXPECT_EQ(screenSize.height, layoutViewItem.logicalHeight().floor());
6721 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6721 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6722 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6722 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6723 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor()); 6723 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
6724 6724
6725 webViewImpl->didExitFullScreen(); 6725 webViewImpl->didExitFullscreen();
6726 webViewImpl->updateAllLifecyclePhases(); 6726 webViewImpl->updateAllLifecyclePhases();
6727 client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width; 6727 client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width;
6728 client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height; 6728 client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height;
6729 webViewHelper.resize(screenSizeMinusStatusBars); 6729 webViewHelper.resize(screenSizeMinusStatusBars);
6730 client.m_screenInfo.rect.width = screenSizeMinusStatusBarsMinusUrlBar.width; 6730 client.m_screenInfo.rect.width = screenSizeMinusStatusBarsMinusUrlBar.width;
6731 client.m_screenInfo.rect.height = screenSizeMinusStatusBarsMinusUrlBar.heigh t; 6731 client.m_screenInfo.rect.height = screenSizeMinusStatusBarsMinusUrlBar.heigh t;
6732 webViewHelper.resize(screenSizeMinusStatusBarsMinusUrlBar); 6732 webViewHelper.resize(screenSizeMinusStatusBarsMinusUrlBar);
6733 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.width, layoutViewItem.logical Width().floor()); 6733 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.width, layoutViewItem.logical Width().floor());
6734 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.height, layoutViewItem.logica lHeight().floor()); 6734 EXPECT_EQ(screenSizeMinusStatusBarsMinusUrlBar.height, layoutViewItem.logica lHeight().floor());
6735 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6735 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
(...skipping 29 matching lines...) Expand all
6765 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor()); 6765 EXPECT_EQ(640, layoutViewItem.logicalHeight().floor());
6766 EXPECT_FLOAT_EQ(0.3125, webViewImpl->pageScaleFactor()); 6766 EXPECT_FLOAT_EQ(0.3125, webViewImpl->pageScaleFactor());
6767 EXPECT_FLOAT_EQ(0.3125, webViewImpl->minimumPageScaleFactor()); 6767 EXPECT_FLOAT_EQ(0.3125, webViewImpl->minimumPageScaleFactor());
6768 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6768 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
6769 6769
6770 Document* document = 6770 Document* document =
6771 toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document(); 6771 toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document();
6772 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 6772 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6773 Fullscreen::from(*document).requestFullscreen( 6773 Fullscreen::from(*document).requestFullscreen(
6774 *document->documentElement(), Fullscreen::PrefixedRequest); 6774 *document->documentElement(), Fullscreen::PrefixedRequest);
6775 webViewImpl->didEnterFullScreen(); 6775 webViewImpl->didEnterFullscreen();
6776 webViewImpl->updateAllLifecyclePhases(); 6776 webViewImpl->updateAllLifecyclePhases();
6777 6777
6778 // Entering fullscreen causes layout size and page scale limits to be 6778 // Entering fullscreen causes layout size and page scale limits to be
6779 // overridden. 6779 // overridden.
6780 EXPECT_EQ(100, layoutViewItem.logicalWidth().floor()); 6780 EXPECT_EQ(100, layoutViewItem.logicalWidth().floor());
6781 EXPECT_EQ(200, layoutViewItem.logicalHeight().floor()); 6781 EXPECT_EQ(200, layoutViewItem.logicalHeight().floor());
6782 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor()); 6782 EXPECT_FLOAT_EQ(1.0, webViewImpl->pageScaleFactor());
6783 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor()); 6783 EXPECT_FLOAT_EQ(1.0, webViewImpl->minimumPageScaleFactor());
6784 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor()); 6784 EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
6785 6785
6786 const char source[] = "<meta name=\"viewport\" content=\"width=200\">"; 6786 const char source[] = "<meta name=\"viewport\" content=\"width=200\">";
6787 6787
6788 // Load a new page before exiting fullscreen. 6788 // Load a new page before exiting fullscreen.
6789 KURL testURL = toKURL("about:blank"); 6789 KURL testURL = toKURL("about:blank");
6790 WebFrame* frame = webViewHelper.webView()->mainFrame(); 6790 WebFrame* frame = webViewHelper.webView()->mainFrame();
6791 FrameTestHelpers::loadHTMLString(frame, source, testURL); 6791 FrameTestHelpers::loadHTMLString(frame, source, testURL);
6792 webViewImpl->didExitFullScreen(); 6792 webViewImpl->didExitFullscreen();
6793 webViewImpl->updateAllLifecyclePhases(); 6793 webViewImpl->updateAllLifecyclePhases();
6794 6794
6795 // Make sure the new page's layout size and scale factor limits aren't 6795 // Make sure the new page's layout size and scale factor limits aren't
6796 // overridden. 6796 // overridden.
6797 layoutViewItem = 6797 layoutViewItem =
6798 webViewImpl->mainFrameImpl()->frameView()->layoutViewItem(); 6798 webViewImpl->mainFrameImpl()->frameView()->layoutViewItem();
6799 EXPECT_EQ(200, layoutViewItem.logicalWidth().floor()); 6799 EXPECT_EQ(200, layoutViewItem.logicalWidth().floor());
6800 EXPECT_EQ(400, layoutViewItem.logicalHeight().floor()); 6800 EXPECT_EQ(400, layoutViewItem.logicalHeight().floor());
6801 EXPECT_FLOAT_EQ(0.5, webViewImpl->minimumPageScaleFactor()); 6801 EXPECT_FLOAT_EQ(0.5, webViewImpl->minimumPageScaleFactor());
6802 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor()); 6802 EXPECT_FLOAT_EQ(5.0, webViewImpl->maximumPageScaleFactor());
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
8813 request.setRequestorOrigin(WebSecurityOrigin::createUnique()); 8813 request.setRequestorOrigin(WebSecurityOrigin::createUnique());
8814 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request); 8814 helper.webViewImpl()->mainFrame()->toWebLocalFrame()->loadRequest(request);
8815 8815
8816 // Normally, the result of the JS url replaces the existing contents on the 8816 // Normally, the result of the JS url replaces the existing contents on the
8817 // Document. However, if the JS triggers a navigation, the contents should 8817 // Document. However, if the JS triggers a navigation, the contents should
8818 // not be replaced. 8818 // not be replaced.
8819 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText()); 8819 EXPECT_EQ("", toLocalFrame(helper.webViewImpl()->page()->mainFrame())->docum ent()->documentElement()->innerText());
8820 } 8820 }
8821 8821
8822 } // namespace blink 8822 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698