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

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

Issue 1772223002: 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 1401 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 // Update the status of our IME back-end. 1412 // Update the status of our IME back-end.
1413 // TODO(hbono): we should verify messages to be sent from the back-end. 1413 // TODO(hbono): we should verify messages to be sent from the back-end.
1414 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME); 1414 view()->UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_NON_IME);
1415 ProcessPendingMessages(); 1415 ProcessPendingMessages();
1416 render_thread_->sink().ClearMessages(); 1416 render_thread_->sink().ClearMessages();
1417 1417
1418 if (ime_message->result) { 1418 if (ime_message->result) {
1419 // Retrieve the content of this page and compare it with the expected 1419 // Retrieve the content of this page and compare it with the expected
1420 // result. 1420 // result.
1421 const int kMaxOutputCharacters = 128; 1421 const int kMaxOutputCharacters = 128;
1422 view()->GetWebView()->updateAllLifecyclePhases();
1423 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( 1422 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText(
1424 GetMainFrame(), kMaxOutputCharacters); 1423 GetMainFrame(), kMaxOutputCharacters);
1425 EXPECT_EQ(base::WideToUTF16(ime_message->result), output); 1424 EXPECT_EQ(base::WideToUTF16(ime_message->result), output);
1426 } 1425 }
1427 } 1426 }
1428 } 1427 }
1429 1428
1430 // Test that the RenderView::OnSetTextDirection() function can change the text 1429 // Test that the RenderView::OnSetTextDirection() function can change the text
1431 // direction of the selected input element. 1430 // direction of the selected input element.
1432 TEST_F(RenderViewImplTest, OnSetTextDirection) { 1431 TEST_F(RenderViewImplTest, OnSetTextDirection) {
(...skipping 30 matching lines...) Expand all
1463 "var result = document.getElementById('result');" 1462 "var result = document.getElementById('result');"
1464 "var node = document.getElementById('test');" 1463 "var node = document.getElementById('test');"
1465 "var style = getComputedStyle(node, null);" 1464 "var style = getComputedStyle(node, null);"
1466 "result.innerText =" 1465 "result.innerText ="
1467 " node.getAttribute('dir') + ',' +" 1466 " node.getAttribute('dir') + ',' +"
1468 " style.getPropertyValue('direction');"); 1467 " style.getPropertyValue('direction');");
1469 1468
1470 // Copy the document content to std::wstring and compare with the 1469 // Copy the document content to std::wstring and compare with the
1471 // expected result. 1470 // expected result.
1472 const int kMaxOutputCharacters = 16; 1471 const int kMaxOutputCharacters = 16;
1473 view()->GetWebView()->updateAllLifecyclePhases();
1474 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText( 1472 base::string16 output = WebFrameContentDumper::dumpFrameTreeAsText(
1475 GetMainFrame(), kMaxOutputCharacters); 1473 GetMainFrame(), kMaxOutputCharacters);
1476 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output); 1474 EXPECT_EQ(base::WideToUTF16(kTextDirection[i].expected_result), output);
1477 } 1475 }
1478 } 1476 }
1479 1477
1480 // Crashy, http://crbug.com/53247. 1478 // Crashy, http://crbug.com/53247.
1481 TEST_F(RenderViewImplTest, DISABLED_DidFailProvisionalLoadWithErrorForError) { 1479 TEST_F(RenderViewImplTest, DISABLED_DidFailProvisionalLoadWithErrorForError) {
1482 GetMainFrame()->enableViewSourceMode(true); 1480 GetMainFrame()->enableViewSourceMode(true);
1483 WebURLError error; 1481 WebURLError error;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 1792
1795 TestRenderFrame* subframe = 1793 TestRenderFrame* subframe =
1796 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame( 1794 static_cast<TestRenderFrame*>(RenderFrameImpl::FromWebFrame(
1797 view()->webview()->findFrameByName("frame"))); 1795 view()->webview()->findFrameByName("frame")));
1798 subframe->Navigate(common_params, StartNavigationParams(), request_params); 1796 subframe->Navigate(common_params, StartNavigationParams(), request_params);
1799 FrameLoadWaiter(subframe).Wait(); 1797 FrameLoadWaiter(subframe).Wait();
1800 1798
1801 // Copy the document content to std::wstring and compare with the 1799 // Copy the document content to std::wstring and compare with the
1802 // expected result. 1800 // expected result.
1803 const int kMaxOutputCharacters = 256; 1801 const int kMaxOutputCharacters = 256;
1804 view()->GetWebView()->updateAllLifecyclePhases();
1805 std::string output = base::UTF16ToUTF8( 1802 std::string output = base::UTF16ToUTF8(
1806 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 1803 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
1807 GetMainFrame(), kMaxOutputCharacters))); 1804 GetMainFrame(), kMaxOutputCharacters)));
1808 EXPECT_EQ(output, "hello \n\nworld"); 1805 EXPECT_EQ(output, "hello \n\nworld");
1809 } 1806 }
1810 1807
1811 // This test ensures that a RenderFrame object is created for the top level 1808 // This test ensures that a RenderFrame object is created for the top level
1812 // frame in the RenderView. 1809 // frame in the RenderView.
1813 TEST_F(RenderViewImplTest, BasicRenderFrame) { 1810 TEST_F(RenderViewImplTest, BasicRenderFrame) {
1814 EXPECT_TRUE(view()->main_render_frame_); 1811 EXPECT_TRUE(view()->main_render_frame_);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 1914 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
1918 common_params.url = GURL("data:text/html,test data"); 1915 common_params.url = GURL("data:text/html,test data");
1919 TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame()); 1916 TestRenderFrame* main_frame = static_cast<TestRenderFrame*>(frame());
1920 main_frame->Navigate(common_params, StartNavigationParams(), 1917 main_frame->Navigate(common_params, StartNavigationParams(),
1921 RequestNavigationParams()); 1918 RequestNavigationParams());
1922 1919
1923 // An error occurred. 1920 // An error occurred.
1924 main_frame->didFailProvisionalLoad(web_frame, error, 1921 main_frame->didFailProvisionalLoad(web_frame, error,
1925 blink::WebStandardCommit); 1922 blink::WebStandardCommit);
1926 const int kMaxOutputCharacters = 22; 1923 const int kMaxOutputCharacters = 22;
1927 view()->GetWebView()->updateAllLifecyclePhases();
1928 EXPECT_EQ("", base::UTF16ToASCII(base::StringPiece16( 1924 EXPECT_EQ("", base::UTF16ToASCII(base::StringPiece16(
1929 WebFrameContentDumper::dumpFrameTreeAsText( 1925 WebFrameContentDumper::dumpFrameTreeAsText(
1930 web_frame, kMaxOutputCharacters)))); 1926 web_frame, kMaxOutputCharacters))));
1931 } 1927 }
1932 1928
1933 #if defined(OS_ANDROID) 1929 #if defined(OS_ANDROID)
1934 // Crashing on Android: http://crbug.com/311341 1930 // Crashing on Android: http://crbug.com/311341
1935 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress 1931 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress
1936 #else 1932 #else
1937 #define MAYBE_DoesNotSuppress DoesNotSuppress 1933 #define MAYBE_DoesNotSuppress DoesNotSuppress
(...skipping 15 matching lines...) Expand all
1953 main_frame->Navigate(common_params, StartNavigationParams(), 1949 main_frame->Navigate(common_params, StartNavigationParams(),
1954 RequestNavigationParams()); 1950 RequestNavigationParams());
1955 1951
1956 // An error occurred. 1952 // An error occurred.
1957 main_frame->didFailProvisionalLoad(web_frame, error, 1953 main_frame->didFailProvisionalLoad(web_frame, error,
1958 blink::WebStandardCommit); 1954 blink::WebStandardCommit);
1959 1955
1960 // The error page itself is loaded asynchronously. 1956 // The error page itself is loaded asynchronously.
1961 FrameLoadWaiter(main_frame).Wait(); 1957 FrameLoadWaiter(main_frame).Wait();
1962 const int kMaxOutputCharacters = 22; 1958 const int kMaxOutputCharacters = 22;
1963 view()->GetWebView()->updateAllLifecyclePhases();
1964 EXPECT_EQ("A suffusion of yellow.", 1959 EXPECT_EQ("A suffusion of yellow.",
1965 base::UTF16ToASCII( 1960 base::UTF16ToASCII(
1966 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 1961 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
1967 web_frame, kMaxOutputCharacters)))); 1962 web_frame, kMaxOutputCharacters))));
1968 } 1963 }
1969 1964
1970 #if defined(OS_ANDROID) 1965 #if defined(OS_ANDROID)
1971 // Crashing on Android: http://crbug.com/311341 1966 // Crashing on Android: http://crbug.com/311341
1972 #define MAYBE_HttpStatusCodeErrorWithEmptyBody \ 1967 #define MAYBE_HttpStatusCodeErrorWithEmptyBody \
1973 DISABLED_HttpStatusCodeErrorWithEmptyBody 1968 DISABLED_HttpStatusCodeErrorWithEmptyBody
(...skipping 15 matching lines...) Expand all
1989 main_frame->Navigate(common_params, StartNavigationParams(), 1984 main_frame->Navigate(common_params, StartNavigationParams(),
1990 RequestNavigationParams()); 1985 RequestNavigationParams());
1991 1986
1992 // Emulate a 4xx/5xx main resource response with an empty body. 1987 // Emulate a 4xx/5xx main resource response with an empty body.
1993 main_frame->didReceiveResponse(1, response); 1988 main_frame->didReceiveResponse(1, response);
1994 main_frame->didFinishDocumentLoad(web_frame, true); 1989 main_frame->didFinishDocumentLoad(web_frame, true);
1995 1990
1996 // The error page itself is loaded asynchronously. 1991 // The error page itself is loaded asynchronously.
1997 FrameLoadWaiter(main_frame).Wait(); 1992 FrameLoadWaiter(main_frame).Wait();
1998 const int kMaxOutputCharacters = 22; 1993 const int kMaxOutputCharacters = 22;
1999 view()->GetWebView()->updateAllLifecyclePhases();
2000 EXPECT_EQ("A suffusion of yellow.", 1994 EXPECT_EQ("A suffusion of yellow.",
2001 base::UTF16ToASCII( 1995 base::UTF16ToASCII(
2002 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText( 1996 base::StringPiece16(WebFrameContentDumper::dumpFrameTreeAsText(
2003 web_frame, kMaxOutputCharacters)))); 1997 web_frame, kMaxOutputCharacters))));
2004 } 1998 }
2005 1999
2006 // Ensure the render view sends favicon url update events correctly. 2000 // Ensure the render view sends favicon url update events correctly.
2007 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) { 2001 TEST_F(RenderViewImplTest, SendFaviconURLUpdateEvent) {
2008 // An event should be sent when a favicon url exists. 2002 // An event should be sent when a favicon url exists.
2009 LoadHTML("<html>" 2003 LoadHTML("<html>"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 FROM_HERE, 2474 FROM_HERE,
2481 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); 2475 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this)));
2482 ExecuteJavaScriptForTests("debugger;"); 2476 ExecuteJavaScriptForTests("debugger;");
2483 2477
2484 // CloseWhilePaused should resume execution and continue here. 2478 // CloseWhilePaused should resume execution and continue here.
2485 EXPECT_FALSE(IsPaused()); 2479 EXPECT_FALSE(IsPaused());
2486 Detach(); 2480 Detach();
2487 } 2481 }
2488 2482
2489 } // namespace content 2483 } // 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