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

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

Issue 1285703004: Update css styles after modifying display mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
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 2088 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 }; 2099 };
2100 2100
2101 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlag s) 2101 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlag s)
2102 { 2102 {
2103 ++m_count; 2103 ++m_count;
2104 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo xFlags); 2104 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo xFlags);
2105 } 2105 }
2106 2106
2107 TEST_F(WebViewTest, ChangeDisplayMode) 2107 TEST_F(WebViewTest, ChangeDisplayMode)
2108 { 2108 {
2109 WebView* webView = m_webViewHelper.initializeAndLoad("about:blank", true); 2109 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("display_mode.html"));
kenneth.r.christiansen 2015/08/17 09:03:36 You forgot to add this display_mode.html file?
a.renevier 2015/08/17 17:25:57 Done.
2110 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo de.html", true);
2110 2111
2111 WebScriptSource source("document.querySelector('body').innerHTML = window.ma tchMedia('(display-mode: minimal-ui)').matches"); 2112 std::string content = webView->mainFrame()->contentAsText(21).utf8();
Mike West 2015/08/17 15:29:06 21?
a.renevier 2015/08/17 17:25:57 size of "regular-ui" + "minimal-ui" + 1
2112 2113 EXPECT_EQ("regular-ui", content);
kenneth.r.christiansen 2015/08/17 09:03:36 regular-ui? That is not a valid value for display-
a.renevier 2015/08/17 17:25:57 In my test file, I only check if display mode is m
2113 webView->mainFrame()->executeScript(source);
2114 std::string content = webView->mainFrame()->contentAsText(5).utf8();
2115 EXPECT_EQ("false", content);
2116 2114
2117 webView->setDisplayMode(WebDisplayModeMinimalUi); 2115 webView->setDisplayMode(WebDisplayModeMinimalUi);
2118 webView->mainFrame()->executeScript(source); 2116 content = webView->mainFrame()->contentAsText(21).utf8();
2119 content = webView->mainFrame()->contentAsText(5).utf8(); 2117 EXPECT_EQ("minimal-ui", content);
2120 EXPECT_EQ("true", content); 2118 m_webViewHelper.reset();
2121 } 2119 }
2122 2120
2123 TEST_F(WebViewTest, AddFrameInCloseUnload) 2121 TEST_F(WebViewTest, AddFrameInCloseUnload)
2124 { 2122 {
2125 CreateChildCounterFrameClient frameClient; 2123 CreateChildCounterFrameClient frameClient;
2126 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html")); 2124 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html"));
2127 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient); 2125 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient);
2128 m_webViewHelper.reset(); 2126 m_webViewHelper.reset();
2129 EXPECT_EQ(0, frameClient.count()); 2127 EXPECT_EQ(0, frameClient.count());
2130 } 2128 }
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 for (size_t i = 0; i < renders.size(); ++i) { 3041 for (size_t i = 0; i < renders.size(); ++i) {
3044 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; 3042 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0;
3045 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); 3043 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime());
3046 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; 3044 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0;
3047 double docDuration = docFinishTime - docStartTime; 3045 double docDuration = docFinishTime - docStartTime;
3048 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); 3046 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration());
3049 } 3047 }
3050 } 3048 }
3051 3049
3052 } // namespace blink 3050 } // namespace blink
OLDNEW
« Source/core/frame/FrameView.cpp ('K') | « Source/core/frame/FrameView.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698