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

Side by Side Diff: content/renderer/render_view_browsertest.cc

Issue 1762993002: Revert of TextIteratorAlgorithm should not force layout update in constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | content/renderer/render_view_browsertest_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 // Update the status of our IME back-end. 1382 // Update the status of our IME back-end.
1383 // TODO(hbono): we should verify messages to be sent from the back-end. 1383 // TODO(hbono): we should verify messages to be sent from the back-end.
1384 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); 1384 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME);
1385 ProcessPendingMessages(); 1385 ProcessPendingMessages();
1386 render_thread_->sink().ClearMessages(); 1386 render_thread_->sink().ClearMessages();
1387 1387
1388 if (ime_message->result) { 1388 if (ime_message->result) {
1389 // Retrieve the content of this page and compare it with the expected 1389 // Retrieve the content of this page and compare it with the expected
1390 // result. 1390 // result.
1391 const int kMaxOutputCharacters = 128; 1391 const int kMaxOutputCharacters = 128;
1392 view()->GetWebView()->updateAllLifecyclePhases();
1393 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( 1392 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText(
1394 GetMainFrame(), kMaxOutputCharacters); 1393 GetMainFrame(), kMaxOutputCharacters);
1395 EXPECT_EQ(base::WideToUTF16(ime_message->result), output); 1394 EXPECT_EQ(base::WideToUTF16(ime_message->result), output);
1396 } 1395 }
1397 } 1396 }
1398 } 1397 }
1399 1398
1400 // Test that the RenderView::OnSetTextDirection() function can change the text 1399 // Test that the RenderView::OnSetTextDirection() function can change the text
1401 // direction of the selected input element. 1400 // direction of the selected input element.
1402 TEST_F(RenderViewImplTest, OnSetTextDirection) { 1401 TEST_F(RenderViewImplTest, OnSetTextDirection) {
(...skipping 30 matching lines...) Expand all
1433 "var result = document.getElementById('result');" 1432 "var result = document.getElementById('result');"
1434 "var node = document.getElementById('test');" 1433 "var node = document.getElementById('test');"
1435 "var style = getComputedStyle(node, null);" 1434 "var style = getComputedStyle(node, null);"
1436 "result.innerText =" 1435 "result.innerText ="
1437 " node.getAttribute('dir') + ',' +" 1436 " node.getAttribute('dir') + ',' +"
1438 " style.getPropertyValue('direction');"); 1437 " style.getPropertyValue('direction');");
1439 1438
1440 // Copy the document content to std::wstring and compare with the 1439 // Copy the document content to std::wstring and compare with the
1441 // expected result. 1440 // expected result.
1442 const int kMaxOutputCharacters = 16; 1441 const int kMaxOutputCharacters = 16;
1443 view()->GetWebView()->updateAllLifecyclePhases();
1444 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( 1442 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText(
1445 GetMainFrame(), kMaxOutputCharacters); 1443 GetMainFrame(), kMaxOutputCharacters);
1446 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output); 1444 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output);
1447 } 1445 }
1448 } 1446 }
1449 1447
1450 // Test that we can receive correct DOM events when we send input events 1448 // Test that we can receive correct DOM events when we send input events
1451 // through the RenderWidget::OnHandleInputEvent() function. 1449 // through the RenderWidget::OnHandleInputEvent() function.
1452 TEST_F(RenderViewImplTest, OnHandleKeyboardEvent) { 1450 TEST_F(RenderViewImplTest, OnHandleKeyboardEvent) {
1453 #if !defined(OS_MACOSX) 1451 #if !defined(OS_MACOSX)
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 "%d,%s", // texts in the third <div> element 1573 "%d,%s", // texts in the third <div> element
1576 key_code, kModifierData[j].expected_result, 1574 key_code, kModifierData[j].expected_result,
1577 static_cast<int>(char_code[0]), 1575 static_cast<int>(char_code[0]),
1578 kModifierData[j].expected_result, 1576 kModifierData[j].expected_result,
1579 key_code, kModifierData[j].expected_result); 1577 key_code, kModifierData[j].expected_result);
1580 1578
1581 // Retrieve the text in the test page and compare it with the expected 1579 // Retrieve the text in the test page and compare it with the expected
1582 // text created from a virtual-key code, a character code, and the 1580 // text created from a virtual-key code, a character code, and the
1583 // modifier-key status. 1581 // modifier-key status.
1584 const int kMaxOutputCharacters = 1024; 1582 const int kMaxOutputCharacters = 1024;
1585 view()->GetWebView()->updateAllLifecyclePhases();
1586 std::string output = base::UTF16ToUTF8( 1583 std::string output = base::UTF16ToUTF8(
1587 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 1584 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
1588 GetMainFrame(), kMaxOutputCharacters))); 1585 GetMainFrame(), kMaxOutputCharacters)));
1589 EXPECT_EQ(expected_result, output); 1586 EXPECT_EQ(expected_result, output);
1590 } 1587 }
1591 } 1588 }
1592 } 1589 }
1593 #else 1590 #else
1594 NOTIMPLEMENTED(); 1591 NOTIMPLEMENTED();
1595 #endif 1592 #endif
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 base::string16 char_code; 1806 base::string16 char_code;
1810 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0) 1807 if (SendKeyEvent(layout, key_code, modifiers, &char_code) < 0)
1811 continue; 1808 continue;
1812 } 1809 }
1813 } 1810 }
1814 1811
1815 // Retrieve the text in the test page and compare it with the expected 1812 // Retrieve the text in the test page and compare it with the expected
1816 // text created from a virtual-key code, a character code, and the 1813 // text created from a virtual-key code, a character code, and the
1817 // modifier-key status. 1814 // modifier-key status.
1818 const int kMaxOutputCharacters = 4096; 1815 const int kMaxOutputCharacters = 4096;
1819 view()->GetWebView()->updateAllLifecyclePhases();
1820 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( 1816 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText(
1821 GetMainFrame(), kMaxOutputCharacters); 1817 GetMainFrame(), kMaxOutputCharacters);
1822 EXPECT_EQ(base::WideToUTF16(kLayouts[i].expected_result), output); 1818 EXPECT_EQ(base::WideToUTF16(kLayouts[i].expected_result), output);
1823 } 1819 }
1824 #else 1820 #else
1825 NOTIMPLEMENTED(); 1821 NOTIMPLEMENTED();
1826 #endif 1822 #endif
1827 } 1823 }
1828 1824
1829 // Crashy, http://crbug.com/53247. 1825 // Crashy, http://crbug.com/53247.
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2146 2142
2147 TestRenderFrame* subframe = 2143 TestRenderFrame* subframe =
2148 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame( 2144 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame(
2149 view()->webview()->findFrameByName("frame"))); 2145 view()->webview()->findFrameByName("frame")));
2150 subframe->Navigate(common_params, StartNavigationParams(), request_params); 2146 subframe->Navigate(common_params, StartNavigationParams(), request_params);
2151 FrameLoadWaiter(subframe).Wait(); 2147 FrameLoadWaiter(subframe).Wait();
2152 2148
2153 // Copy the document content to std::wstring and compare with the 2149 // Copy the document content to std::wstring and compare with the
2154 // expected result. 2150 // expected result.
2155 const int kMaxOutputCharacters = 256; 2151 const int kMaxOutputCharacters = 256;
2156 view()->GetWebView()->updateAllLifecyclePhases();
2157 std::string output = base::UTF16ToUTF8( 2152 std::string output = base::UTF16ToUTF8(
2158 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 2153 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
2159 GetMainFrame(), kMaxOutputCharacters))); 2154 GetMainFrame(), kMaxOutputCharacters)));
2160 EXPECT_EQ(output, "hello \n\nworld"); 2155 EXPECT_EQ(output, "hello \n\nworld");
2161 } 2156 }
2162 2157
2163 // This test ensures that a RenderFrame object is created for the top level 2158 // This test ensures that a RenderFrame object is created for the top level
2164 // frame in the RenderView. 2159 // frame in the RenderView.
2165 TEST_F(RenderViewImplTest, BasicRenderFrame) { 2160 TEST_F(RenderViewImplTest, BasicRenderFrame) {
2166 EXPECT_TRUE(view()->main_render_frame_); 2161 EXPECT_TRUE(view()->main_render_frame_);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2269 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 2264 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
2270 common_params.url = GURL("data:text/html,test data"); 2265 common_params.url = GURL("data:text/html,test data");
2271 TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame()); 2266 TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame());
2272 main_frame->Navigate(common_params, StartNavigationParams(), 2267 main_frame->Navigate(common_params, StartNavigationParams(),
2273 RequestNavigationParams()); 2268 RequestNavigationParams());
2274 2269
2275 // An error occurred. 2270 // An error occurred.
2276 main_frame->didFailProvisionalLoad(web_frame, error, 2271 main_frame->didFailProvisionalLoad(web_frame, error,
2277 blink::WebStandardCommit); 2272 blink::WebStandardCommit);
2278 const int kMaxOutputCharacters = 22; 2273 const int kMaxOutputCharacters = 22;
2279 view()->GetWebView()->updateAllLifecyclePhases();
2280 EXPECT_EQ("", base::UTF16ToASCII(base::StringPiece16( 2274 EXPECT_EQ("", base::UTF16ToASCII(base::StringPiece16(
2281 WebFrameContentDumper::dumpFrameTreeAsText( 2275 WebFrameContentDumper::dumpFrameTreeAsText(
2282 web_frame, kMaxOutputCharacters)))); 2276 web_frame, kMaxOutputCharacters))));
2283 } 2277 }
2284 2278
2285 #if defined(OS_ANDROID) 2279 #if defined(OS_ANDROID)
2286 // Crashing on Android: http://crbug.com/311341 2280 // Crashing on Android: http://crbug.com/311341
2287 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress 2281 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress
2288 #else 2282 #else
2289 #define MAYBE_DoesNotSuppress DoesNotSuppress 2283 #define MAYBE_DoesNotSuppress DoesNotSuppress
(...skipping 15 matching lines...) Expand all
2305 main_frame->Navigate(common_params, StartNavigationParams(), 2299 main_frame->Navigate(common_params, StartNavigationParams(),
2306 RequestNavigationParams()); 2300 RequestNavigationParams());
2307 2301
2308 // An error occurred. 2302 // An error occurred.
2309 main_frame->didFailProvisionalLoad(web_frame, error, 2303 main_frame->didFailProvisionalLoad(web_frame, error,
2310 blink::WebStandardCommit); 2304 blink::WebStandardCommit);
2311 2305
2312 // The error page itself is loaded asynchronously. 2306 // The error page itself is loaded asynchronously.
2313 FrameLoadWaiter(main_frame).Wait(); 2307 FrameLoadWaiter(main_frame).Wait();
2314 const int kMaxOutputCharacters = 22; 2308 const int kMaxOutputCharacters = 22;
2315 view()->GetWebView()->updateAllLifecyclePhases();
2316 EXPECT_EQ("A suffusion of yellow.", 2309 EXPECT_EQ("A suffusion of yellow.",
2317 base::UTF16ToASCII( 2310 base::UTF16ToASCII(
2318 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 2311 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
2319 web_frame, kMaxOutputCharacters)))); 2312 web_frame, kMaxOutputCharacters))));
2320 } 2313 }
2321 2314
2322 #if defined(OS_ANDROID) 2315 #if defined(OS_ANDROID)
2323 // Crashing on Android: http://crbug.com/311341 2316 // Crashing on Android: http://crbug.com/311341
2324 #define MAYBE_HttpStatusCodeErrorWithEmptyBody \ 2317 #define MAYBE_HttpStatusCodeErrorWithEmptyBody \
2325 DISABLED_HttpStatusCodeErrorWithEmptyBody 2318 DISABLED_HttpStatusCodeErrorWithEmptyBody
(...skipping 15 matching lines...) Expand all
2341 main_frame->Navigate(common_params, StartNavigationParams(), 2334 main_frame->Navigate(common_params, StartNavigationParams(),
2342 RequestNavigationParams()); 2335 RequestNavigationParams());
2343 2336
2344 // Emulate a 4xx/5xx main resource response with an empty body. 2337 // Emulate a 4xx/5xx main resource response with an empty body.
2345 main_frame->didReceiveResponse(1, response); 2338 main_frame->didReceiveResponse(1, response);
2346 main_frame->didFinishDocumentLoad(web_frame, true); 2339 main_frame->didFinishDocumentLoad(web_frame, true);
2347 2340
2348 // The error page itself is loaded asynchronously. 2341 // The error page itself is loaded asynchronously.
2349 FrameLoadWaiter(main_frame).Wait(); 2342 FrameLoadWaiter(main_frame).Wait();
2350 const int kMaxOutputCharacters = 22; 2343 const int kMaxOutputCharacters = 22;
2351 view()->GetWebView()->updateAllLifecyclePhases();
2352 EXPECT_EQ("A suffusion of yellow.", 2344 EXPECT_EQ("A suffusion of yellow.",
2353 base::UTF16ToASCII( 2345 base::UTF16ToASCII(
2354 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 2346 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
2355 web_frame, kMaxOutputCharacters)))); 2347 web_frame, kMaxOutputCharacters))));
2356 } 2348 }
2357 2349
2358 // Ensure the render view sends favicon url update events correctly. 2350 // Ensure the render view sends favicon url update events correctly.
2359 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) { 2351 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) {
2360 // An event should be sent when a favicon url exists. 2352 // An event should be sent when a favicon url exists.
2361 LoadHTML("<html>" 2353 LoadHTML("<html>"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 FROM_HERE, 2796 FROM_HERE,
2805 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2797 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2806 ExecuteJavaScriptForTests("debugger;"); 2798 ExecuteJavaScriptForTests("debugger;");
2807 2799
2808 // CloseWhilePaused should resume execution and continue here. 2800 // CloseWhilePaused should resume execution and continue here.
2809 EXPECT_FALSE(IsPaused()); 2801 EXPECT_FALSE(IsPaused());
2810 Detach(); 2802 Detach();
2811 } 2803 }
2812 2804
2813 } // namespace content 2805 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_view_browsertest_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698