| 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 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 // but won't complete synchronously. | 2121 // but won't complete synchronously. |
| 2122 FrameMsg_Navigate_Params params; | 2122 FrameMsg_Navigate_Params params; |
| 2123 params.page_id = -1; | 2123 params.page_id = -1; |
| 2124 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2124 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2125 params.url = GURL("data:text/html,test data"); | 2125 params.url = GURL("data:text/html,test data"); |
| 2126 frame()->OnNavigate(params); | 2126 frame()->OnNavigate(params); |
| 2127 | 2127 |
| 2128 // An error occurred. | 2128 // An error occurred. |
| 2129 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); | 2129 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
| 2130 const int kMaxOutputCharacters = 22; | 2130 const int kMaxOutputCharacters = 22; |
| 2131 EXPECT_EQ("", UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2131 EXPECT_EQ("", |
| 2132 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
| 2132 } | 2133 } |
| 2133 | 2134 |
| 2134 #if defined(OS_ANDROID) | 2135 #if defined(OS_ANDROID) |
| 2135 // Crashing on Android: http://crbug.com/311341 | 2136 // Crashing on Android: http://crbug.com/311341 |
| 2136 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress | 2137 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress |
| 2137 #else | 2138 #else |
| 2138 #define MAYBE_DoesNotSuppress DoesNotSuppress | 2139 #define MAYBE_DoesNotSuppress DoesNotSuppress |
| 2139 #endif | 2140 #endif |
| 2140 | 2141 |
| 2141 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { | 2142 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { |
| 2142 WebURLError error; | 2143 WebURLError error; |
| 2143 error.domain = WebString::fromUTF8(net::kErrorDomain); | 2144 error.domain = WebString::fromUTF8(net::kErrorDomain); |
| 2144 error.reason = net::ERR_FILE_NOT_FOUND; | 2145 error.reason = net::ERR_FILE_NOT_FOUND; |
| 2145 error.unreachableURL = GURL("http://example.com/dont-suppress"); | 2146 error.unreachableURL = GURL("http://example.com/dont-suppress"); |
| 2146 WebFrame* web_frame = GetMainFrame(); | 2147 WebFrame* web_frame = GetMainFrame(); |
| 2147 | 2148 |
| 2148 // Start a load that will reach provisional state synchronously, | 2149 // Start a load that will reach provisional state synchronously, |
| 2149 // but won't complete synchronously. | 2150 // but won't complete synchronously. |
| 2150 FrameMsg_Navigate_Params params; | 2151 FrameMsg_Navigate_Params params; |
| 2151 params.page_id = -1; | 2152 params.page_id = -1; |
| 2152 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2153 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2153 params.url = GURL("data:text/html,test data"); | 2154 params.url = GURL("data:text/html,test data"); |
| 2154 frame()->OnNavigate(params); | 2155 frame()->OnNavigate(params); |
| 2155 | 2156 |
| 2156 // An error occurred. | 2157 // An error occurred. |
| 2157 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); | 2158 view()->main_render_frame()->didFailProvisionalLoad(web_frame, error); |
| 2158 ProcessPendingMessages(); | 2159 ProcessPendingMessages(); |
| 2159 const int kMaxOutputCharacters = 22; | 2160 const int kMaxOutputCharacters = 22; |
| 2160 EXPECT_EQ("A suffusion of yellow.", | 2161 EXPECT_EQ("A suffusion of yellow.", |
| 2161 UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2162 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
| 2162 } | 2163 } |
| 2163 | 2164 |
| 2164 // Tests if IME API's candidatewindow* events sent from browser are handled | 2165 // Tests if IME API's candidatewindow* events sent from browser are handled |
| 2165 // in renderer. | 2166 // in renderer. |
| 2166 TEST_F(RenderViewImplTest, SendCandidateWindowEvents) { | 2167 TEST_F(RenderViewImplTest, SendCandidateWindowEvents) { |
| 2167 // Sends an HTML with an <input> element and scripts to the renderer. | 2168 // Sends an HTML with an <input> element and scripts to the renderer. |
| 2168 // The script handles all 3 of candidatewindow* events for an | 2169 // The script handles all 3 of candidatewindow* events for an |
| 2169 // InputMethodContext object and once it received 'show', 'update', 'hide' | 2170 // InputMethodContext object and once it received 'show', 'update', 'hide' |
| 2170 // should appear in the result div. | 2171 // should appear in the result div. |
| 2171 LoadHTML("<input id='test'>" | 2172 LoadHTML("<input id='test'>" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 request.setTargetType(blink::WebURLRequest::TargetIsSubresource); | 2323 request.setTargetType(blink::WebURLRequest::TargetIsSubresource); |
| 2323 blink::WebURLResponse redirect_response; | 2324 blink::WebURLResponse redirect_response; |
| 2324 frame()->willSendRequest(GetMainFrame(), 0, request, redirect_response); | 2325 frame()->willSendRequest(GetMainFrame(), 0, request, redirect_response); |
| 2325 extra_data = static_cast<RequestExtraData*>(request.extraData()); | 2326 extra_data = static_cast<RequestExtraData*>(request.extraData()); |
| 2326 ASSERT_TRUE(extra_data); | 2327 ASSERT_TRUE(extra_data); |
| 2327 EXPECT_EQ(extra_data->service_worker_provider_id(), | 2328 EXPECT_EQ(extra_data->service_worker_provider_id(), |
| 2328 provider->provider_id()); | 2329 provider->provider_id()); |
| 2329 } | 2330 } |
| 2330 | 2331 |
| 2331 } // namespace content | 2332 } // namespace content |
| OLD | NEW |