| 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 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2331 "<input id='test2' value='hello2'></input>"); | 2331 "<input id='test2' value='hello2'></input>"); |
| 2332 | 2332 |
| 2333 ExecuteJavaScript("document.getElementById('test1').focus();"); | 2333 ExecuteJavaScript("document.getElementById('test1').focus();"); |
| 2334 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( | 2334 const IPC::Message* msg1 = render_thread_->sink().GetFirstMessageMatching( |
| 2335 ViewHostMsg_FocusedNodeChanged::ID); | 2335 ViewHostMsg_FocusedNodeChanged::ID); |
| 2336 EXPECT_TRUE(msg1); | 2336 EXPECT_TRUE(msg1); |
| 2337 | 2337 |
| 2338 ViewHostMsg_FocusedNodeChanged::Param params; | 2338 ViewHostMsg_FocusedNodeChanged::Param params; |
| 2339 ViewHostMsg_FocusedNodeChanged::Read(msg1, ¶ms); | 2339 ViewHostMsg_FocusedNodeChanged::Read(msg1, ¶ms); |
| 2340 EXPECT_TRUE(params.a); | 2340 EXPECT_TRUE(params.a); |
| 2341 EXPECT_EQ(blink::WebInputEvent:Undefined, params.b); |
| 2341 render_thread_->sink().ClearMessages(); | 2342 render_thread_->sink().ClearMessages(); |
| 2342 | 2343 |
| 2343 ExecuteJavaScript("document.getElementById('test2').focus();"); | 2344 ExecuteJavaScript("document.getElementById('test2').focus();"); |
| 2344 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching( | 2345 const IPC::Message* msg2 = render_thread_->sink().GetFirstMessageMatching( |
| 2345 ViewHostMsg_FocusedNodeChanged::ID); | 2346 ViewHostMsg_FocusedNodeChanged::ID); |
| 2346 EXPECT_TRUE(msg2); | 2347 EXPECT_TRUE(msg2); |
| 2347 ViewHostMsg_FocusedNodeChanged::Read(msg2, ¶ms); | 2348 ViewHostMsg_FocusedNodeChanged::Read(msg2, ¶ms); |
| 2348 EXPECT_TRUE(params.a); | 2349 EXPECT_TRUE(params.a); |
| 2350 EXPECT_EQ(blink::WebInputEvent:Undefined, params.b); |
| 2349 render_thread_->sink().ClearMessages(); | 2351 render_thread_->sink().ClearMessages(); |
| 2350 | 2352 |
| 2351 view()->webview()->clearFocusedElement(); | 2353 view()->webview()->clearFocusedElement(); |
| 2352 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching( | 2354 const IPC::Message* msg3 = render_thread_->sink().GetFirstMessageMatching( |
| 2353 ViewHostMsg_FocusedNodeChanged::ID); | 2355 ViewHostMsg_FocusedNodeChanged::ID); |
| 2354 EXPECT_TRUE(msg3); | 2356 EXPECT_TRUE(msg3); |
| 2355 ViewHostMsg_FocusedNodeChanged::Read(msg3, ¶ms); | 2357 ViewHostMsg_FocusedNodeChanged::Read(msg3, ¶ms); |
| 2356 EXPECT_FALSE(params.a); | 2358 EXPECT_FALSE(params.a); |
| 2359 EXPECT_EQ(blink::WebInputEvent:Undefined, params.b); |
| 2357 render_thread_->sink().ClearMessages(); | 2360 render_thread_->sink().ClearMessages(); |
| 2358 } | 2361 } |
| 2359 | 2362 |
| 2360 TEST_F(RenderViewImplTest, ServiceWorkerNetworkProviderSetup) { | 2363 TEST_F(RenderViewImplTest, ServiceWorkerNetworkProviderSetup) { |
| 2361 ServiceWorkerNetworkProvider* provider = NULL; | 2364 ServiceWorkerNetworkProvider* provider = NULL; |
| 2362 RequestExtraData* extra_data = NULL; | 2365 RequestExtraData* extra_data = NULL; |
| 2363 | 2366 |
| 2364 // Make sure each new document has a new provider and | 2367 // Make sure each new document has a new provider and |
| 2365 // that the main request is tagged with the provider's id. | 2368 // that the main request is tagged with the provider's id. |
| 2366 LoadHTML("<b>A Document</b>"); | 2369 LoadHTML("<b>A Document</b>"); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 ProcessPendingMessages(); | 2502 ProcessPendingMessages(); |
| 2500 base::Time after_navigation = | 2503 base::Time after_navigation = |
| 2501 base::Time::Now() + base::TimeDelta::FromDays(1); | 2504 base::Time::Now() + base::TimeDelta::FromDays(1); |
| 2502 | 2505 |
| 2503 base::Time late_nav_reported_start = | 2506 base::Time late_nav_reported_start = |
| 2504 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2507 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
| 2505 EXPECT_LE(late_nav_reported_start, after_navigation); | 2508 EXPECT_LE(late_nav_reported_start, after_navigation); |
| 2506 } | 2509 } |
| 2507 | 2510 |
| 2508 } // namespace content | 2511 } // namespace content |
| OLD | NEW |