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

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

Powered by Google App Engine
This is Rietveld 408576698