| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <queue> | 5 #include <queue> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 | 1662 |
| 1663 // 2. Create a menu item and wait for created callback to be called. | 1663 // 2. Create a menu item and wait for created callback to be called. |
| 1664 ExecuteScriptWaitForTitle(embedder, "createMenuItem()", "ITEM_CREATED"); | 1664 ExecuteScriptWaitForTitle(embedder, "createMenuItem()", "ITEM_CREATED"); |
| 1665 | 1665 |
| 1666 // 3. Click the created item, wait for the click handlers to fire from JS. | 1666 // 3. Click the created item, wait for the click handlers to fire from JS. |
| 1667 ExtensionTestMessageListener click_listener("ITEM_CLICKED", false); | 1667 ExtensionTestMessageListener click_listener("ITEM_CLICKED", false); |
| 1668 GURL page_url("http://www.google.com"); | 1668 GURL page_url("http://www.google.com"); |
| 1669 // Create and build our test context menu. | 1669 // Create and build our test context menu. |
| 1670 scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create( | 1670 scoped_ptr<TestRenderViewContextMenu> menu(TestRenderViewContextMenu::Create( |
| 1671 guest_web_contents, page_url, GURL(), GURL())); | 1671 guest_web_contents, page_url, GURL(), GURL())); |
| 1672 | |
| 1673 // Look for the extension item in the menu, and execute it. | 1672 // Look for the extension item in the menu, and execute it. |
| 1674 int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0); | 1673 int command_id = ContextMenuMatcher::ConvertToExtensionsCustomCommandId(0); |
| 1675 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); | 1674 ASSERT_TRUE(menu->IsCommandIdEnabled(command_id)); |
| 1676 menu->ExecuteCommand(command_id, 0); | 1675 menu->ExecuteCommand(command_id, 0); |
| 1677 | |
| 1678 // Wait for embedder's script to tell us its onclick fired, it does | 1676 // Wait for embedder's script to tell us its onclick fired, it does |
| 1679 // chrome.test.sendMessage('ITEM_CLICKED') | 1677 // chrome.test.sendMessage('ITEM_CLICKED') |
| 1680 ASSERT_TRUE(click_listener.WaitUntilSatisfied()); | 1678 ASSERT_TRUE(click_listener.WaitUntilSatisfied()); |
| 1681 | 1679 |
| 1682 // 4. Update the item's title and verify. | 1680 // 4. Update the item's title and verify. |
| 1683 ExecuteScriptWaitForTitle(embedder, "updateMenuItem()", "ITEM_UPDATED"); | 1681 ExecuteScriptWaitForTitle(embedder, "updateMenuItem()", "ITEM_UPDATED"); |
| 1684 MenuItem::List items = GetItems(); | 1682 MenuItem::List items = GetItems(); |
| 1685 ASSERT_EQ(1u, items.size()); | 1683 ASSERT_EQ(1u, items.size()); |
| 1686 MenuItem* item = items.at(0); | 1684 MenuItem* item = items.at(0); |
| 1687 EXPECT_EQ("new_title", item->title()); | 1685 EXPECT_EQ("new_title", item->title()); |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2563 // Generate and send synthetic touch event. | 2561 // Generate and send synthetic touch event. |
| 2564 FocusWaiter waiter(aura_webview); | 2562 FocusWaiter waiter(aura_webview); |
| 2565 content::SimulateTouchPressAt(GetEmbedderWebContents(), | 2563 content::SimulateTouchPressAt(GetEmbedderWebContents(), |
| 2566 guest_rect.CenterPoint()); | 2564 guest_rect.CenterPoint()); |
| 2567 | 2565 |
| 2568 // Wait for the TouchStart to propagate and restore focus. Test times out | 2566 // Wait for the TouchStart to propagate and restore focus. Test times out |
| 2569 // on failure. | 2567 // on failure. |
| 2570 waiter.Wait(); | 2568 waiter.Wait(); |
| 2571 } | 2569 } |
| 2572 #endif | 2570 #endif |
| OLD | NEW |