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

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

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