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

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

Issue 263973003: Move LoadProgressTracker to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final comment Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_impl.h » ('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 "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 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
2232 // An event should not be sent if no favicon url exists. This is an assumption 2232 // An event should not be sent if no favicon url exists. This is an assumption
2233 // made by some of Chrome's favicon handling. 2233 // made by some of Chrome's favicon handling.
2234 LoadHTML("<html>" 2234 LoadHTML("<html>"
2235 "<head>" 2235 "<head>"
2236 "</head>" 2236 "</head>"
2237 "</html>"); 2237 "</html>");
2238 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching( 2238 EXPECT_FALSE(render_thread_->sink().GetFirstMessageMatching(
2239 ViewHostMsg_UpdateFaviconURL::ID)); 2239 ViewHostMsg_UpdateFaviconURL::ID));
2240 } 2240 }
2241 2241
2242 // Test progress tracker messages.
2243 TEST_F(RenderViewImplTest, SendProgressCompletionUpdates) {
2244 std::string data_url_string = "data:text/html,<body>placeholder</body>";
2245 GURL url(data_url_string);
2246 GetMainFrame()->loadRequest(blink::WebURLRequest(url));
2247
2248 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching(
2249 FrameHostMsg_DidStartLoading::ID));
2250
2251 // The load started, we should receive a start notification and a progress
2252 // update with the minimum progress.
2253 const IPC::Message* message = render_thread_->sink().GetFirstMessageMatching(
2254 ViewHostMsg_DidChangeLoadProgress::ID);
2255 EXPECT_TRUE(message);
2256 Tuple1<double> progress_value;
2257 ViewHostMsg_DidChangeLoadProgress::Read(message, &progress_value);
2258 EXPECT_EQ(0.1, progress_value.a);
2259 render_thread_->sink().ClearMessages();
2260
2261 FrameLoadWaiter(frame()).Wait();
2262
2263 // The data url has loaded, so we should see a progress change to 1.0 (done)
2264 // and a stop notification.
2265 message = render_thread_->sink().GetUniqueMessageMatching(
2266 ViewHostMsg_DidChangeLoadProgress::ID);
2267 EXPECT_TRUE(message);
2268 ViewHostMsg_DidChangeLoadProgress::Read(message, &progress_value);
2269 EXPECT_EQ(1.0, progress_value.a);
2270
2271 EXPECT_TRUE(render_thread_->sink().GetFirstMessageMatching(
2272 FrameHostMsg_DidStopLoading::ID));
2273 render_thread_->sink().ClearMessages();
2274 }
2275
2276 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) { 2242 TEST_F(RenderViewImplTest, FocusElementCallsFocusedNodeChanged) {
2277 LoadHTML("<input id='test1' value='hello1'></input>" 2243 LoadHTML("<input id='test1' value='hello1'></input>"
2278 "<input id='test2' value='hello2'></input>"); 2244 "<input id='test2' value='hello2'></input>");
2279 2245
2280 ExecuteJavaScript("document.getElementById('test1').focus();"); 2246 ExecuteJavaScript("document.getElementById('test1').focus();");
2281 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( 2247 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching(
2282 ViewHostMsg_FocusedNodeChanged::ID); 2248 ViewHostMsg_FocusedNodeChanged::ID);
2283 EXPECT_TRUE(msg1); 2249 EXPECT_TRUE(msg1);
2284 2250
2285 ViewHostMsg_FocusedNodeChanged::Param params; 2251 ViewHostMsg_FocusedNodeChanged::Param params;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
2367 view()->renderer_accessibility()->GetType()); 2333 view()->renderer_accessibility()->GetType());
2368 2334
2369 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); 2335 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly);
2370 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); 2336 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode());
2371 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); 2337 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility());
2372 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, 2338 ASSERT_EQ(RendererAccessibilityTypeFocusOnly,
2373 view()->renderer_accessibility()->GetType()); 2339 view()->renderer_accessibility()->GetType());
2374 } 2340 }
2375 2341
2376 } // namespace content 2342 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | content/renderer/render_view_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698