| Index: content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm
|
| ===================================================================
|
| --- content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm (revision 147462)
|
| +++ content/browser/renderer_host/render_widget_host_view_mac_editcommand_helper_unittest.mm (working copy)
|
| @@ -16,12 +16,8 @@
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "testing/platform_test.h"
|
|
|
| -using content::MockRenderProcessHost;
|
| -using content::RenderWidgetHostImpl;
|
| +using content::RenderWidgetHostViewMac;
|
|
|
| -class RenderWidgetHostViewMacEditCommandHelperTest : public PlatformTest {
|
| -};
|
| -
|
| // Bare bones obj-c class for testing purposes.
|
| @interface RenderWidgetHostViewMacEditCommandHelperTestClass : NSObject
|
| @end
|
| @@ -53,26 +49,25 @@
|
|
|
| @end
|
|
|
| +namespace content {
|
| +namespace {
|
|
|
| -namespace {
|
| - // Returns true if all the edit command names in the array are present
|
| - // in test_obj.
|
| - // edit_commands is a list of NSStrings, selector names are formed by
|
| - // appending a trailing ':' to the string.
|
| - bool CheckObjectRespondsToEditCommands(NSArray* edit_commands,
|
| - id test_obj) {
|
| - for (NSString* edit_command_name in edit_commands) {
|
| - NSString* sel_str = [edit_command_name stringByAppendingString:@":"];
|
| - if (![test_obj respondsToSelector:NSSelectorFromString(sel_str)]) {
|
| - return false;
|
| - }
|
| +// Returns true if all the edit command names in the array are present in
|
| +// test_obj. edit_commands is a list of NSStrings, selector names are formed
|
| +// by appending a trailing ':' to the string.
|
| +bool CheckObjectRespondsToEditCommands(NSArray* edit_commands, id test_obj) {
|
| + for (NSString* edit_command_name in edit_commands) {
|
| + NSString* sel_str = [edit_command_name stringByAppendingString:@":"];
|
| + if (![test_obj respondsToSelector:NSSelectorFromString(sel_str)]) {
|
| + return false;
|
| }
|
| + }
|
| + return true;
|
| +}
|
|
|
| - return true;
|
| - }
|
| } // namespace
|
|
|
| -class MockRenderWidgetHostDelegate : public content::RenderWidgetHostDelegate {
|
| +class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate {
|
| public:
|
| MockRenderWidgetHostDelegate() {}
|
| virtual ~MockRenderWidgetHostDelegate() {}
|
| @@ -82,8 +77,8 @@
|
| class RenderWidgetHostEditCommandCounter : public RenderWidgetHostImpl {
|
| public:
|
| RenderWidgetHostEditCommandCounter(
|
| - content::RenderWidgetHostDelegate* delegate,
|
| - content::RenderProcessHost* process,
|
| + RenderWidgetHostDelegate* delegate,
|
| + RenderProcessHost* process,
|
| int routing_id)
|
| : RenderWidgetHostImpl(delegate, process, routing_id),
|
| edit_command_message_count_(0) {
|
| @@ -98,6 +93,8 @@
|
| unsigned int edit_command_message_count_;
|
| };
|
|
|
| +class RenderWidgetHostViewMacEditCommandHelperTest : public PlatformTest {
|
| +};
|
|
|
| // Tests that editing commands make it through the pipeline all the way to
|
| // RenderWidgetHost.
|
| @@ -109,7 +106,7 @@
|
|
|
| // Set up a mock render widget and set expectations.
|
| MessageLoopForUI message_loop;
|
| - content::TestBrowserContext browser_context;
|
| + TestBrowserContext browser_context;
|
| MockRenderProcessHost mock_process(&browser_context);
|
| MockRenderWidgetHostDelegate delegate;
|
| RenderWidgetHostEditCommandCounter render_widget(&delegate, &mock_process, 0);
|
| @@ -117,7 +114,7 @@
|
| // RenderWidgetHostViewMac self destructs (RenderWidgetHostViewMacCocoa
|
| // takes ownership) so no need to delete it ourselves.
|
| RenderWidgetHostViewMac* rwhvm = static_cast<RenderWidgetHostViewMac*>(
|
| - content::RenderWidgetHostView::CreateViewForWidget(&render_widget));
|
| + RenderWidgetHostView::CreateViewForWidget(&render_widget));
|
|
|
| RenderWidgetHostViewMacOwner* rwhwvm_owner =
|
| [[[RenderWidgetHostViewMacOwner alloc]
|
| @@ -181,3 +178,5 @@
|
| // TODO(jeremy): Currently IsMenuItemEnabled just returns true for all edit
|
| // selectors. Once we go past that we should do more extensive testing here.
|
| }
|
| +
|
| +} // namespace content
|
|
|