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

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

Issue 473903002: Avoid auto-resize re-entrancy problems. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased 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
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/web/tests/data/subtree-layout.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "third_party/skia/include/core/SkBitmap.h" 75 #include "third_party/skia/include/core/SkBitmap.h"
76 #include "third_party/skia/include/core/SkBitmapDevice.h" 76 #include "third_party/skia/include/core/SkBitmapDevice.h"
77 #include "third_party/skia/include/core/SkCanvas.h" 77 #include "third_party/skia/include/core/SkCanvas.h"
78 #include "web/WebLocalFrameImpl.h" 78 #include "web/WebLocalFrameImpl.h"
79 #include "web/WebSettingsImpl.h" 79 #include "web/WebSettingsImpl.h"
80 #include "web/WebViewImpl.h" 80 #include "web/WebViewImpl.h"
81 #include "web/tests/FrameTestHelpers.h" 81 #include "web/tests/FrameTestHelpers.h"
82 #include <gtest/gtest.h> 82 #include <gtest/gtest.h>
83 83
84 using namespace blink; 84 using namespace blink;
85 using blink::FrameTestHelpers::loadFrame;
85 using blink::FrameTestHelpers::runPendingTasks; 86 using blink::FrameTestHelpers::runPendingTasks;
86 using blink::URLTestHelpers::toKURL; 87 using blink::URLTestHelpers::toKURL;
87 88
88 namespace { 89 namespace {
89 90
90 enum HorizontalScrollbarState { 91 enum HorizontalScrollbarState {
91 NoHorizontalScrollbar, 92 NoHorizontalScrollbar,
92 VisibleHorizontalScrollbar, 93 VisibleHorizontalScrollbar,
93 }; 94 };
94 95
(...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 2164
2164 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame()); 2165 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
2165 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)"))); 2166 frame->executeScript(WebScriptSource(WebString::fromUTF8("document.execComma nd('SelectAll', false, null)")));
2166 std::string actual = frame->selectionAsText().utf8(); 2167 std::string actual = frame->selectionAsText().utf8();
2167 2168
2168 const int kMaxOutputCharacters = 1024; 2169 const int kMaxOutputCharacters = 1024;
2169 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8(); 2170 std::string expected = frame->contentAsText(kMaxOutputCharacters).utf8();
2170 EXPECT_EQ(expected, actual); 2171 EXPECT_EQ(expected, actual);
2171 } 2172 }
2172 2173
2174 TEST_F(WebViewTest, AutoResizeSubtreeLayout)
2175 {
2176 std::string url = m_baseURL + "subtree-layout.html";
2177 URLTestHelpers::registerMockedURLLoad(toKURL(url), "subtree-layout.html");
2178 WebView* webView = m_webViewHelper.initialize(true);
2179
2180 webView->enableAutoResizeMode(WebSize(200, 200), WebSize(200, 200));
2181 loadFrame(webView->mainFrame(), url);
2182
2183 blink::FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl() ->frameView();
2184
2185 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T his EXPECT is
2186 // merely a dummy. The real test is that we don't trigger asserts in debug b uilds.
2187 EXPECT_FALSE(frameView->needsLayout());
2188 };
2189
2173 } // namespace 2190 } // namespace
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.cpp ('k') | Source/web/tests/data/subtree-layout.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698