| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/common/native_web_keyboard_event.h" | 5 #include "chrome/common/native_web_keyboard_event.h" |
| 6 #include "chrome/common/render_messages.h" | 6 #include "chrome/common/render_messages.h" |
| 7 #include "chrome/test/render_view_test.h" | 7 #include "chrome/test/render_view_test.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 TEST_F(RenderViewTest, OnLoadAlternateHTMLText) { | 10 TEST_F(RenderViewTest, OnLoadAlternateHTMLText) { |
| 11 // Test a new navigation. | 11 // Test a new navigation. |
| 12 GURL test_url("http://www.google.com/some_test_url"); | 12 GURL test_url("http://www.google.com/some_test_url"); |
| 13 view_->OnLoadAlternateHTMLText("<html></html>", true, test_url, | 13 view_->OnLoadAlternateHTMLText("<html></html>", true, test_url, |
| 14 std::string()); | 14 std::string()); |
| 15 | 15 |
| 16 // We should have gotten two different types of start messages in the | 16 // We should have gotten two different types of start messages in the |
| 17 // following order. | 17 // following order. |
| 18 ASSERT_EQ((size_t)2, render_thread_.sink().message_count()); | 18 ASSERT_EQ((size_t)2, render_thread_.sink().message_count()); |
| 19 const IPC::Message* msg = render_thread_.sink().GetMessageAt(0); | 19 const IPC::Message* msg = render_thread_.sink().GetMessageAt(0); |
| 20 EXPECT_EQ(ViewHostMsg_DidStartLoading::ID, msg->type()); | 20 EXPECT_EQ(ViewHostMsg_DidStartLoading::ID, msg->type()); |
| 21 | 21 |
| 22 msg = render_thread_.sink().GetMessageAt(1); | 22 msg = render_thread_.sink().GetMessageAt(1); |
| 23 EXPECT_EQ(ViewHostMsg_DidStartProvisionalLoadForFrame::ID, msg->type()); | 23 EXPECT_EQ(ViewHostMsg_DidStartProvisionalLoadForFrame::ID, msg->type()); |
| 24 ViewHostMsg_DidStartProvisionalLoadForFrame::Param start_params; | 24 ViewHostMsg_DidStartProvisionalLoadForFrame::Param start_params; |
| 25 ViewHostMsg_DidStartProvisionalLoadForFrame::Read(msg, &start_params); | 25 ViewHostMsg_DidStartProvisionalLoadForFrame::Read(msg, &start_params); |
| 26 EXPECT_EQ(GURL("chrome-ui://chromewebdata/"), start_params.b); | 26 EXPECT_EQ(GURL("chrome://chromewebdata/"), start_params.b); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // Test that we get form state change notifications when input fields change. | 29 // Test that we get form state change notifications when input fields change. |
| 30 TEST_F(RenderViewTest, OnNavStateChanged) { | 30 TEST_F(RenderViewTest, OnNavStateChanged) { |
| 31 // Don't want any delay for form state sync changes. This will still post a | 31 // Don't want any delay for form state sync changes. This will still post a |
| 32 // message so updates will get coalesced, but as soon as we spin the message | 32 // message so updates will get coalesced, but as soon as we spin the message |
| 33 // loop, it will generate an update. | 33 // loop, it will generate an update. |
| 34 view_->set_delay_seconds_for_form_state_sync(0); | 34 view_->set_delay_seconds_for_form_state_sync(0); |
| 35 | 35 |
| 36 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>"); | 36 LoadHTML("<input type=\"text\" id=\"elt_text\"></input>"); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 UnloadKeyboardLayout(handle); | 482 UnloadKeyboardLayout(handle); |
| 483 } | 483 } |
| 484 | 484 |
| 485 // Restore the keyboard layout and status. | 485 // Restore the keyboard layout and status. |
| 486 SetKeyboardState(&original_key_states[0]); | 486 SetKeyboardState(&original_key_states[0]); |
| 487 ActivateKeyboardLayout(original_layout, KLF_RESET); | 487 ActivateKeyboardLayout(original_layout, KLF_RESET); |
| 488 #else | 488 #else |
| 489 NOTIMPLEMENTED(); | 489 NOTIMPLEMENTED(); |
| 490 #endif | 490 #endif |
| 491 } | 491 } |
| OLD | NEW |