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