| 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 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2223 // An event should not be sent if no favicon url exists. This is an assumption | 2223 // An event should not be sent if no favicon url exists. This is an assumption |
| 2224 // made by some of Chrome's favicon handling. | 2224 // made by some of Chrome's favicon handling. |
| 2225 LoadHTML("<html>" | 2225 LoadHTML("<html>" |
| 2226 "<head>" | 2226 "<head>" |
| 2227 "</head>" | 2227 "</head>" |
| 2228 "</html>"); | 2228 "</html>"); |
| 2229 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( | 2229 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( |
| 2230 ViewHostMsg_UpdateFaviconURL::ID)); | 2230 ViewHostMsg_UpdateFaviconURL::ID)); |
| 2231 } | 2231 } |
| 2232 | 2232 |
| 2233 // Test progress tracker messages. | |
| 2234 TEST_F(RenderViewImplTest, SendProgressCompletionUpdates) { | |
| 2235 std::string data_url_string = "data:text/html,<body>placeholder</body>"; | |
| 2236 GURL url(data_url_string); | |
| 2237 GetMainFrame()->loadRequest(blink::WebURLRequest(url)); | |
| 2238 | |
| 2239 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( | |
| 2240 FrameHostMsg_DidStartLoading::ID)); | |
| 2241 | |
| 2242 // The load started, we should receive a start notification and a progress | |
| 2243 // update with the minimum progress. | |
| 2244 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching( | |
| 2245 ViewHostMsg_DidChangeLoadProgress::ID); | |
| 2246 EXPECT_TRUE(message); | |
| 2247 Tuple1<double> progress_value; | |
| 2248 ViewHostMsg_DidChangeLoadProgress::Read(message, &progress_value); | |
| 2249 EXPECT_EQ(0.1, progress_value.a); | |
| 2250 render_thread_->sink().ClearMessages(); | |
| 2251 | |
| 2252 ProcessPendingMessages(); | |
| 2253 | |
| 2254 // The data url has loaded, so we should see a progress change to 1.0 (done) | |
| 2255 // and a stop notification. | |
| 2256 message = render_thread_->sink().GetFirstMessageMatching( | |
| 2257 ViewHostMsg_DidChangeLoadProgress::ID); | |
| 2258 EXPECT_TRUE(message); | |
| 2259 ViewHostMsg_DidChangeLoadProgress::Read(message, &progress_value); | |
| 2260 EXPECT_EQ(1.0, progress_value.a); | |
| 2261 | |
| 2262 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching( | |
| 2263 FrameHostMsg_DidStopLoading::ID)); | |
| 2264 render_thread_->sink().ClearMessages(); | |
| 2265 } | |
| 2266 | |
| 2267 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) { | 2233 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) { |
| 2268 LoadHTML("<input id='test1' value='hello1'></input>" | 2234 LoadHTML("<input id='test1' value='hello1'></input>" |
| 2269 "<input id='test2' value='hello2'></input>"); | 2235 "<input id='test2' value='hello2'></input>"); |
| 2270 | 2236 |
| 2271 ExecuteJavaScript("document.getElementById('test1').focus();"); | 2237 ExecuteJavaScript("document.getElementById('test1').focus();"); |
| 2272 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( | 2238 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( |
| 2273 ViewHostMsg_FocusedNodeChanged::ID); | 2239 ViewHostMsg_FocusedNodeChanged::ID); |
| 2274 EXPECT_TRUE(msg1); | 2240 EXPECT_TRUE(msg1); |
| 2275 | 2241 |
| 2276 ViewHostMsg_FocusedNodeChanged::Param params; | 2242 ViewHostMsg_FocusedNodeChanged::Param params; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2358 view()->renderer_accessibility()->GetType()); | 2324 view()->renderer_accessibility()->GetType()); |
| 2359 | 2325 |
| 2360 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); | 2326 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); |
| 2361 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); | 2327 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); |
| 2362 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); | 2328 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); |
| 2363 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, | 2329 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, |
| 2364 view()->renderer_accessibility()->GetType()); | 2330 view()->renderer_accessibility()->GetType()); |
| 2365 } | 2331 } |
| 2366 | 2332 |
| 2367 } // namespace content | 2333 } // namespace content |
| OLD | NEW |