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

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
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/display_mode.html » ('j') | 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) 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 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 }; 2082 };
2083 2083
2084 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlag s) 2084 WebFrame* CreateChildCounterFrameClient::createChildFrame(WebLocalFrame* parent, WebTreeScopeType scope, const WebString& frameName, WebSandboxFlags sandboxFlag s)
2085 { 2085 {
2086 ++m_count; 2086 ++m_count;
2087 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo xFlags); 2087 return TestWebFrameClient::createChildFrame(parent, scope, frameName, sandbo xFlags);
2088 } 2088 }
2089 2089
2090 TEST_F(WebViewTest, ChangeDisplayMode) 2090 TEST_F(WebViewTest, ChangeDisplayMode)
2091 { 2091 {
2092 WebView* webView = m_webViewHelper.initializeAndLoad("about:blank", true); 2092 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("display_mode.html"));
2093 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "display_mo de.html", true);
2093 2094
2094 WebScriptSource source("document.querySelector('body').innerHTML = window.ma tchMedia('(display-mode: minimal-ui)').matches"); 2095 std::string content = webView->mainFrame()->contentAsText(21).utf8();
2095 2096 EXPECT_EQ("regular-ui", content);
2096 webView->mainFrame()->executeScript(source);
2097 std::string content = webView->mainFrame()->contentAsText(5).utf8();
2098 EXPECT_EQ("false", content);
2099 2097
2100 webView->setDisplayMode(WebDisplayModeMinimalUi); 2098 webView->setDisplayMode(WebDisplayModeMinimalUi);
2101 webView->mainFrame()->executeScript(source); 2099 content = webView->mainFrame()->contentAsText(21).utf8();
2102 content = webView->mainFrame()->contentAsText(5).utf8(); 2100 EXPECT_EQ("minimal-ui", content);
2103 EXPECT_EQ("true", content); 2101 m_webViewHelper.reset();
2104 } 2102 }
2105 2103
2106 TEST_F(WebViewTest, AddFrameInCloseUnload) 2104 TEST_F(WebViewTest, AddFrameInCloseUnload)
2107 { 2105 {
2108 CreateChildCounterFrameClient frameClient; 2106 CreateChildCounterFrameClient frameClient;
2109 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html")); 2107 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), WebString::fromUTF8("add_frame_in_unload.html"));
2110 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient); 2108 m_webViewHelper.initializeAndLoad(m_baseURL + "add_frame_in_unload.html", tr ue, &frameClient);
2111 m_webViewHelper.reset(); 2109 m_webViewHelper.reset();
2112 EXPECT_EQ(0, frameClient.count()); 2110 EXPECT_EQ(0, frameClient.count());
2113 } 2111 }
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
3359 webViewImpl->advanceFocusInForm(WebFocusTypeBackward); 3357 webViewImpl->advanceFocusInForm(WebFocusTypeBackward);
3360 } 3358 }
3361 // Now focus will stay on previous focus itself, because it has no previous 3359 // Now focus will stay on previous focus itself, because it has no previous
3362 // element. 3360 // element.
3363 EXPECT_EQ(currentFocus, document->focusedElement()); 3361 EXPECT_EQ(currentFocus, document->focusedElement());
3364 3362
3365 m_webViewHelper.reset(); 3363 m_webViewHelper.reset();
3366 } 3364 }
3367 3365
3368 } // namespace blink 3366 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/display_mode.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698