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

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

Issue 497723002: Merge willEnter/willExitFullScreen into didEnter/didExitFullScreen (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 895
896 // Make the page scale and scroll with the given paremeters. 896 // Make the page scale and scroll with the given paremeters.
897 webViewImpl->setPageScaleFactor(2.0f); 897 webViewImpl->setPageScaleFactor(2.0f);
898 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84)); 898 webViewImpl->setMainFrameScrollOffset(WebPoint(116, 84));
899 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); 899 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor());
900 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); 900 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width);
901 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); 901 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height);
902 902
903 RefPtrWillBeRawPtr<blink::Element> element = static_cast<PassRefPtrWillBeRaw Ptr<blink::Element> >(webViewImpl->mainFrame()->document().body()); 903 RefPtrWillBeRawPtr<blink::Element> element = static_cast<PassRefPtrWillBeRaw Ptr<blink::Element> >(webViewImpl->mainFrame()->document().body());
904 webViewImpl->enterFullScreenForElement(element.get()); 904 webViewImpl->enterFullScreenForElement(element.get());
905 webViewImpl->willEnterFullScreen();
906 webViewImpl->didEnterFullScreen(); 905 webViewImpl->didEnterFullScreen();
907 906
908 // Page scale factor must be 1.0 during fullscreen for elements to be sized 907 // Page scale factor must be 1.0 during fullscreen for elements to be sized
909 // properly. 908 // properly.
910 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor()); 909 EXPECT_EQ(1.0f, webViewImpl->pageScaleFactor());
911 910
912 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving. 911 // Make sure fullscreen nesting doesn't disrupt scroll/scale saving.
913 RefPtrWillBeRawPtr<blink::Element> otherElement = static_cast<PassRefPtrWill BeRawPtr<blink::Element> >(webViewImpl->mainFrame()->document().head()); 912 RefPtrWillBeRawPtr<blink::Element> otherElement = static_cast<PassRefPtrWill BeRawPtr<blink::Element> >(webViewImpl->mainFrame()->document().head());
914 webViewImpl->enterFullScreenForElement(otherElement.get()); 913 webViewImpl->enterFullScreenForElement(otherElement.get());
915 914
916 // Confirm that exiting fullscreen restores the parameters. 915 // Confirm that exiting fullscreen restores the parameters.
917 webViewImpl->willExitFullScreen();
918 webViewImpl->didExitFullScreen(); 916 webViewImpl->didExitFullScreen();
919 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor()); 917 EXPECT_EQ(2.0f, webViewImpl->pageScaleFactor());
920 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width); 918 EXPECT_EQ(116, webViewImpl->mainFrame()->scrollOffset().width);
921 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height); 919 EXPECT_EQ(84, webViewImpl->mainFrame()->scrollOffset().height);
922 920
923 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client. 921 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally scoped client.
924 } 922 }
925 923
926 class PrintWebViewClient : public FrameTestHelpers::TestWebViewClient { 924 class PrintWebViewClient : public FrameTestHelpers::TestWebViewClient {
927 public: 925 public:
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); 2162 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
2165 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)"))); 2163 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)")));
2166 std::string actual = frame->selectionAsText().utf8(); 2164 std::string actual = frame->selectionAsText().utf8();
2167 2165
2168 const int kMaxOutputCharacters = 1024; 2166 const int kMaxOutputCharacters = 1024;
2169 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8(); 2167 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8();
2170 EXPECT_EQ(expected, actual); 2168 EXPECT_EQ(expected, actual);
2171 } 2169 }
2172 2170
2173 } // namespace 2171 } // namespace
OLDNEW
« Source/core/dom/Fullscreen.cpp ('K') | « Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698