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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 | 6 |
7 #include "base/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 | 1552 |
1553 // Start a load that will reach provisional state synchronously, | 1553 // Start a load that will reach provisional state synchronously, |
1554 // but won't complete synchronously. | 1554 // but won't complete synchronously. |
1555 ViewMsg_Navigate_Params params; | 1555 ViewMsg_Navigate_Params params; |
1556 params.page_id = -1; | 1556 params.page_id = -1; |
1557 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 1557 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
1558 params.url = GURL("data:text/html,test data"); | 1558 params.url = GURL("data:text/html,test data"); |
1559 view()->OnNavigate(params); | 1559 view()->OnNavigate(params); |
1560 | 1560 |
1561 // An error occurred. | 1561 // An error occurred. |
1562 view()->didFailProvisionalLoad(web_frame, error); | 1562 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
1563 // Frame should exit view-source mode. | 1563 // Frame should exit view-source mode. |
1564 EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); | 1564 EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); |
1565 } | 1565 } |
1566 | 1566 |
1567 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) { | 1567 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) { |
1568 GetMainFrame()->enableViewSourceMode(true); | 1568 GetMainFrame()->enableViewSourceMode(true); |
1569 WebURLError error; | 1569 WebURLError error; |
1570 error.domain = WebString::fromUTF8(net::kErrorDomain); | 1570 error.domain = WebString::fromUTF8(net::kErrorDomain); |
1571 error.reason = net::ERR_ABORTED; | 1571 error.reason = net::ERR_ABORTED; |
1572 error.unreachableURL = GURL("http://foo"); | 1572 error.unreachableURL = GURL("http://foo"); |
1573 WebFrame* web_frame = GetMainFrame(); | 1573 WebFrame* web_frame = GetMainFrame(); |
1574 | 1574 |
1575 // Start a load that will reach provisional state synchronously, | 1575 // Start a load that will reach provisional state synchronously, |
1576 // but won't complete synchronously. | 1576 // but won't complete synchronously. |
1577 ViewMsg_Navigate_Params params; | 1577 ViewMsg_Navigate_Params params; |
1578 params.page_id = -1; | 1578 params.page_id = -1; |
1579 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 1579 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
1580 params.url = GURL("data:text/html,test data"); | 1580 params.url = GURL("data:text/html,test data"); |
1581 view()->OnNavigate(params); | 1581 view()->OnNavigate(params); |
1582 | 1582 |
1583 // A cancellation occurred. | 1583 // A cancellation occurred. |
1584 view()->didFailProvisionalLoad(web_frame, error); | 1584 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
1585 // Frame should stay in view-source mode. | 1585 // Frame should stay in view-source mode. |
1586 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); | 1586 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); |
1587 } | 1587 } |
1588 | 1588 |
1589 // Regression test for http://crbug.com/41562 | 1589 // Regression test for http://crbug.com/41562 |
1590 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { | 1590 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { |
1591 const GURL invalid_gurl("http://"); | 1591 const GURL invalid_gurl("http://"); |
1592 view()->setMouseOverURL(blink::WebURL(invalid_gurl)); | 1592 view()->setMouseOverURL(blink::WebURL(invalid_gurl)); |
1593 EXPECT_EQ(invalid_gurl, view()->target_url_); | 1593 EXPECT_EQ(invalid_gurl, view()->target_url_); |
1594 } | 1594 } |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 | 2106 |
2107 // Start a load that will reach provisional state synchronously, | 2107 // Start a load that will reach provisional state synchronously, |
2108 // but won't complete synchronously. | 2108 // but won't complete synchronously. |
2109 ViewMsg_Navigate_Params params; | 2109 ViewMsg_Navigate_Params params; |
2110 params.page_id = -1; | 2110 params.page_id = -1; |
2111 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 2111 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
2112 params.url = GURL("data:text/html,test data"); | 2112 params.url = GURL("data:text/html,test data"); |
2113 view()->OnNavigate(params); | 2113 view()->OnNavigate(params); |
2114 | 2114 |
2115 // An error occurred. | 2115 // An error occurred. |
2116 view()->didFailProvisionalLoad(web_frame, error); | 2116 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
2117 const int kMaxOutputCharacters = 22; | 2117 const int kMaxOutputCharacters = 22; |
2118 EXPECT_EQ("", UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2118 EXPECT_EQ("", UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
2119 } | 2119 } |
2120 | 2120 |
2121 #if defined(OS_ANDROID) | 2121 #if defined(OS_ANDROID) |
2122 // Crashing on Android: http://crbug.com/311341 | 2122 // Crashing on Android: http://crbug.com/311341 |
2123 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress | 2123 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress |
2124 #else | 2124 #else |
2125 #define MAYBE_DoesNotSuppress DoesNotSuppress | 2125 #define MAYBE_DoesNotSuppress DoesNotSuppress |
2126 #endif | 2126 #endif |
2127 | 2127 |
2128 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { | 2128 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { |
2129 WebURLError error; | 2129 WebURLError error; |
2130 error.domain = WebString::fromUTF8(net::kErrorDomain); | 2130 error.domain = WebString::fromUTF8(net::kErrorDomain); |
2131 error.reason = net::ERR_FILE_NOT_FOUND; | 2131 error.reason = net::ERR_FILE_NOT_FOUND; |
2132 error.unreachableURL = GURL("http://example.com/dont-suppress"); | 2132 error.unreachableURL = GURL("http://example.com/dont-suppress"); |
2133 WebFrame* web_frame = GetMainFrame(); | 2133 WebFrame* web_frame = GetMainFrame(); |
2134 | 2134 |
2135 // Start a load that will reach provisional state synchronously, | 2135 // Start a load that will reach provisional state synchronously, |
2136 // but won't complete synchronously. | 2136 // but won't complete synchronously. |
2137 ViewMsg_Navigate_Params params; | 2137 ViewMsg_Navigate_Params params; |
2138 params.page_id = -1; | 2138 params.page_id = -1; |
2139 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 2139 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
2140 params.url = GURL("data:text/html,test data"); | 2140 params.url = GURL("data:text/html,test data"); |
2141 view()->OnNavigate(params); | 2141 view()->OnNavigate(params); |
2142 | 2142 |
2143 // An error occurred. | 2143 // An error occurred. |
2144 view()->didFailProvisionalLoad(web_frame, error); | 2144 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
2145 ProcessPendingMessages(); | 2145 ProcessPendingMessages(); |
2146 const int kMaxOutputCharacters = 22; | 2146 const int kMaxOutputCharacters = 22; |
2147 EXPECT_EQ("A suffusion of yellow.", | 2147 EXPECT_EQ("A suffusion of yellow.", |
2148 UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2148 UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
2149 } | 2149 } |
2150 | 2150 |
2151 // Tests if IME API's candidatewindow* events sent from browser are handled | 2151 // Tests if IME API's candidatewindow* events sent from browser are handled |
2152 // in renderer. | 2152 // in renderer. |
2153 TEST_F(RenderViewImplTest, SendCandidateWindowEvents) { | 2153 TEST_F(RenderViewImplTest, SendCandidateWindowEvents) { |
2154 // Sends an HTML with an <input> element and scripts to the renderer. | 2154 // Sends an HTML with an <input> element and scripts to the renderer. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2202 // made by some of Chrome's favicon handling. | 2202 // made by some of Chrome's favicon handling. |
2203 LoadHTML("<html>" | 2203 LoadHTML("<html>" |
2204 "<head>" | 2204 "<head>" |
2205 "</head>" | 2205 "</head>" |
2206 "</html>"); | 2206 "</html>"); |
2207 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( | 2207 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( |
2208 ViewHostMsg_UpdateFaviconURL::ID)); | 2208 ViewHostMsg_UpdateFaviconURL::ID)); |
2209 } | 2209 } |
2210 | 2210 |
2211 } // namespace content | 2211 } // namespace content |
OLD | NEW |