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 "apps/app_window.h" | |
6 #include "apps/app_window_registry.h" | |
7 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
11 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
12 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
13 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" | 12 #include "chrome/browser/renderer_context_menu/render_view_context_menu_browsert
est_util.h" |
15 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" | 13 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti
l.h" |
16 #include "chrome/test/base/interactive_test_utils.h" | 14 #include "chrome/test/base/interactive_test_utils.h" |
17 #include "chrome/test/base/test_launcher_utils.h" | 15 #include "chrome/test/base/test_launcher_utils.h" |
18 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
19 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
20 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
21 #include "content/public/browser/render_view_host.h" | 19 #include "content/public/browser/render_view_host.h" |
22 #include "content/public/browser/render_widget_host_iterator.h" | 20 #include "content/public/browser/render_widget_host_iterator.h" |
23 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
24 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
26 #include "content/public/test/browser_test_utils.h" | 24 #include "content/public/test/browser_test_utils.h" |
| 25 #include "extensions/browser/app_window/app_window.h" |
| 26 #include "extensions/browser/app_window/app_window_registry.h" |
27 #include "extensions/browser/guest_view/guest_view_base.h" | 27 #include "extensions/browser/guest_view/guest_view_base.h" |
28 #include "extensions/browser/guest_view/guest_view_manager.h" | 28 #include "extensions/browser/guest_view/guest_view_manager.h" |
29 #include "extensions/browser/guest_view/guest_view_manager_factory.h" | 29 #include "extensions/browser/guest_view/guest_view_manager_factory.h" |
30 #include "net/test/embedded_test_server/embedded_test_server.h" | 30 #include "net/test/embedded_test_server/embedded_test_server.h" |
31 #include "ui/base/ime/composition_text.h" | 31 #include "ui/base/ime/composition_text.h" |
32 #include "ui/base/ime/text_input_client.h" | 32 #include "ui/base/ime/text_input_client.h" |
33 #include "ui/base/test/ui_controls.h" | 33 #include "ui/base/test/ui_controls.h" |
34 #include "ui/events/keycodes/keyboard_codes.h" | 34 #include "ui/events/keycodes/keyboard_codes.h" |
35 | 35 |
36 using apps::AppWindow; | 36 using extensions::AppWindow; |
37 | 37 |
38 class TestGuestViewManager : public extensions::GuestViewManager { | 38 class TestGuestViewManager : public extensions::GuestViewManager { |
39 public: | 39 public: |
40 explicit TestGuestViewManager(content::BrowserContext* context) : | 40 explicit TestGuestViewManager(content::BrowserContext* context) : |
41 GuestViewManager(context), | 41 GuestViewManager(context), |
42 web_contents_(NULL) {} | 42 web_contents_(NULL) {} |
43 | 43 |
44 content::WebContents* WaitForGuestCreated() { | 44 content::WebContents* WaitForGuestCreated() { |
45 if (web_contents_) | 45 if (web_contents_) |
46 return web_contents_; | 46 return web_contents_; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 SendMouseEvent(button, ui_controls::DOWN); | 126 SendMouseEvent(button, ui_controls::DOWN); |
127 SendMouseEvent(button, ui_controls::UP); | 127 SendMouseEvent(button, ui_controls::UP); |
128 } | 128 } |
129 | 129 |
130 void MoveMouseInsideWindow(const gfx::Point& point) { | 130 void MoveMouseInsideWindow(const gfx::Point& point) { |
131 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( | 131 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( |
132 gfx::Point(corner_.x() + point.x(), corner_.y() + point.y()))); | 132 gfx::Point(corner_.x() + point.x(), corner_.y() + point.y()))); |
133 } | 133 } |
134 | 134 |
135 gfx::NativeWindow GetPlatformAppWindow() { | 135 gfx::NativeWindow GetPlatformAppWindow() { |
136 const apps::AppWindowRegistry::AppWindowList& app_windows = | 136 const extensions::AppWindowRegistry::AppWindowList& app_windows = |
137 apps::AppWindowRegistry::Get(browser()->profile())->app_windows(); | 137 extensions::AppWindowRegistry::Get(browser()->profile())->app_windows(); |
138 return (*app_windows.begin())->GetNativeWindow(); | 138 return (*app_windows.begin())->GetNativeWindow(); |
139 } | 139 } |
140 | 140 |
141 void SendKeyPressToPlatformApp(ui::KeyboardCode key) { | 141 void SendKeyPressToPlatformApp(ui::KeyboardCode key) { |
142 ASSERT_EQ(1U, GetAppWindowCount()); | 142 ASSERT_EQ(1U, GetAppWindowCount()); |
143 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( | 143 ASSERT_TRUE(ui_test_utils::SendKeyPressToWindowSync( |
144 GetPlatformAppWindow(), key, false, false, false, false)); | 144 GetPlatformAppWindow(), key, false, false, false, false)); |
145 } | 145 } |
146 | 146 |
147 void SendCopyKeyPressToPlatformApp() { | 147 void SendCopyKeyPressToPlatformApp() { |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 // Now verify that the selection text propagates properly to RWHV. | 1107 // Now verify that the selection text propagates properly to RWHV. |
1108 content::RenderWidgetHostView* guest_rwhv = | 1108 content::RenderWidgetHostView* guest_rwhv = |
1109 guest_web_contents()->GetRenderWidgetHostView(); | 1109 guest_web_contents()->GetRenderWidgetHostView(); |
1110 ASSERT_TRUE(guest_rwhv); | 1110 ASSERT_TRUE(guest_rwhv); |
1111 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); | 1111 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); |
1112 ASSERT_TRUE(selected_text.size() >= 10u); | 1112 ASSERT_TRUE(selected_text.size() >= 10u); |
1113 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); | 1113 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); |
1114 } | 1114 } |
1115 #endif | 1115 #endif |
OLD | NEW |