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 | 6 |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 EXPECT_EQ(7, info.selectionStart); | 1852 EXPECT_EQ(7, info.selectionStart); |
1853 EXPECT_EQ(7, info.selectionEnd); | 1853 EXPECT_EQ(7, info.selectionEnd); |
1854 view()->OnSetEditableSelectionOffsets(4, 8); | 1854 view()->OnSetEditableSelectionOffsets(4, 8); |
1855 view()->OnExtendSelectionAndDelete(2, 5); | 1855 view()->OnExtendSelectionAndDelete(2, 5); |
1856 info = view()->webview()->textInputInfo(); | 1856 info = view()->webview()->textInputInfo(); |
1857 EXPECT_EQ("abuvwxyz", info.value); | 1857 EXPECT_EQ("abuvwxyz", info.value); |
1858 EXPECT_EQ(2, info.selectionStart); | 1858 EXPECT_EQ(2, info.selectionStart); |
1859 EXPECT_EQ(2, info.selectionEnd); | 1859 EXPECT_EQ(2, info.selectionEnd); |
1860 } | 1860 } |
1861 | 1861 |
| 1862 // Test that the navigating specific frames works correctly. |
| 1863 TEST_F(RenderViewImplTest, NavigateFrame) { |
| 1864 // Load page A. |
| 1865 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
| 1866 |
| 1867 // Navigate the frame only. |
| 1868 ViewMsg_Navigate_Params nav_params; |
| 1869 nav_params.url = GURL("data:text/html,world"); |
| 1870 nav_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 1871 nav_params.transition = PAGE_TRANSITION_TYPED; |
| 1872 nav_params.current_history_list_length = 1; |
| 1873 nav_params.current_history_list_offset = 0; |
| 1874 nav_params.pending_history_list_offset = 1; |
| 1875 nav_params.page_id = -1; |
| 1876 nav_params.frame_to_navigate = "frame"; |
| 1877 view()->OnNavigate(nav_params); |
| 1878 ProcessPendingMessages(); |
| 1879 |
| 1880 // Copy the document content to std::wstring and compare with the |
| 1881 // expected result. |
| 1882 const int kMaxOutputCharacters = 256; |
| 1883 std::wstring output = UTF16ToWideHack( |
| 1884 GetMainFrame()->contentAsText(kMaxOutputCharacters)); |
| 1885 EXPECT_EQ(output, L"hello \n\nworld"); |
| 1886 } |
| 1887 |
1862 } // namespace content | 1888 } // namespace content |
OLD | NEW |