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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 EXPECT_GT(expected_page_id_2, expected_page_id); | 1576 EXPECT_GT(expected_page_id_2, expected_page_id); |
1577 view()->OnSetHistoryLengthAndPrune(2, -1); | 1577 view()->OnSetHistoryLengthAndPrune(2, -1); |
1578 EXPECT_EQ(4, view()->history_list_length_); | 1578 EXPECT_EQ(4, view()->history_list_length_); |
1579 EXPECT_EQ(3, view()->history_list_offset_); | 1579 EXPECT_EQ(3, view()->history_list_offset_); |
1580 EXPECT_EQ(-1, view()->history_page_ids_[0]); | 1580 EXPECT_EQ(-1, view()->history_page_ids_[0]); |
1581 EXPECT_EQ(-1, view()->history_page_ids_[1]); | 1581 EXPECT_EQ(-1, view()->history_page_ids_[1]); |
1582 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); | 1582 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); |
1583 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[3]); | 1583 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[3]); |
1584 } | 1584 } |
1585 | 1585 |
| 1586 #if defined(ENABLE_WEB_INTENTS) |
1586 TEST_F(RenderViewImplTest, FindTitleForIntentsPage) { | 1587 TEST_F(RenderViewImplTest, FindTitleForIntentsPage) { |
1587 view()->set_send_content_state_immediately(true); | 1588 view()->set_send_content_state_immediately(true); |
1588 LoadHTML("<html><head><title>title</title>" | 1589 LoadHTML("<html><head><title>title</title>" |
1589 "<intent action=\"a\" type=\"t\"></intent></head></html>"); | 1590 "<intent action=\"a\" type=\"t\"></intent></head></html>"); |
1590 WebKit::WebIntentServiceInfo service; | 1591 WebKit::WebIntentServiceInfo service; |
1591 service.setAction(ASCIIToUTF16("a")); | 1592 service.setAction(ASCIIToUTF16("a")); |
1592 service.setType(ASCIIToUTF16("t")); | 1593 service.setType(ASCIIToUTF16("t")); |
1593 view()->registerIntentService(GetMainFrame(), service); | 1594 view()->registerIntentService(GetMainFrame(), service); |
1594 ProcessPendingMessages(); | 1595 ProcessPendingMessages(); |
1595 | 1596 |
1596 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 1597 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
1597 IntentsHostMsg_RegisterIntentService::ID)); | 1598 IntentsHostMsg_RegisterIntentService::ID)); |
1598 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 1599 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
1599 IntentsHostMsg_RegisterIntentService::ID); | 1600 IntentsHostMsg_RegisterIntentService::ID); |
1600 ASSERT_TRUE(msg); | 1601 ASSERT_TRUE(msg); |
1601 webkit_glue::WebIntentServiceData service_data; | 1602 webkit_glue::WebIntentServiceData service_data; |
1602 bool user_gesture = true; | 1603 bool user_gesture = true; |
1603 IntentsHostMsg_RegisterIntentService::Read(msg, &service_data, &user_gesture); | 1604 IntentsHostMsg_RegisterIntentService::Read(msg, &service_data, &user_gesture); |
1604 EXPECT_EQ(ASCIIToUTF16("a"), service_data.action); | 1605 EXPECT_EQ(ASCIIToUTF16("a"), service_data.action); |
1605 EXPECT_EQ(ASCIIToUTF16("t"), service_data.type); | 1606 EXPECT_EQ(ASCIIToUTF16("t"), service_data.type); |
1606 EXPECT_EQ(ASCIIToUTF16("title"), service_data.title); | 1607 EXPECT_EQ(ASCIIToUTF16("title"), service_data.title); |
1607 EXPECT_FALSE(user_gesture); | 1608 EXPECT_FALSE(user_gesture); |
1608 } | 1609 } |
| 1610 #endif |
1609 | 1611 |
1610 TEST_F(RenderViewImplTest, ContextMenu) { | 1612 TEST_F(RenderViewImplTest, ContextMenu) { |
1611 LoadHTML("<div>Page A</div>"); | 1613 LoadHTML("<div>Page A</div>"); |
1612 | 1614 |
1613 // Create a right click in the center of the iframe. (I'm hoping this will | 1615 // Create a right click in the center of the iframe. (I'm hoping this will |
1614 // make this a bit more robust in case of some other formatting or other bug.) | 1616 // make this a bit more robust in case of some other formatting or other bug.) |
1615 WebMouseEvent mouse_event; | 1617 WebMouseEvent mouse_event; |
1616 mouse_event.type = WebInputEvent::MouseDown; | 1618 mouse_event.type = WebInputEvent::MouseDown; |
1617 mouse_event.button = WebMouseEvent::ButtonRight; | 1619 mouse_event.button = WebMouseEvent::ButtonRight; |
1618 mouse_event.x = 250; | 1620 mouse_event.x = 250; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 | 1844 |
1843 // Copy the document content to std::wstring and compare with the | 1845 // Copy the document content to std::wstring and compare with the |
1844 // expected result. | 1846 // expected result. |
1845 const int kMaxOutputCharacters = 256; | 1847 const int kMaxOutputCharacters = 256; |
1846 std::wstring output = UTF16ToWideHack( | 1848 std::wstring output = UTF16ToWideHack( |
1847 GetMainFrame()->contentAsText(kMaxOutputCharacters)); | 1849 GetMainFrame()->contentAsText(kMaxOutputCharacters)); |
1848 EXPECT_EQ(output, L"hello \n\nworld"); | 1850 EXPECT_EQ(output, L"hello \n\nworld"); |
1849 } | 1851 } |
1850 | 1852 |
1851 } // namespace content | 1853 } // namespace content |
OLD | NEW |