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 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" | 5 #import "content/browser/renderer_host/render_widget_host_view_mac_editcommand_h
elper.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include "base/mac/scoped_nsautorelease_pool.h" | 11 #include "base/mac/scoped_nsautorelease_pool.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/test/scoped_task_environment.h" |
13 #include "base/test/scoped_task_scheduler.h" | |
14 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
15 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 14 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
16 #include "content/browser/gpu/compositor_util.h" | 15 #include "content/browser/gpu/compositor_util.h" |
17 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 16 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
18 #include "content/browser/renderer_host/render_widget_host_impl.h" | 17 #include "content/browser/renderer_host/render_widget_host_impl.h" |
19 #include "content/common/input_messages.h" | 18 #include "content/common/input_messages.h" |
20 #include "content/public/test/mock_render_process_host.h" | 19 #include "content/public/test/mock_render_process_host.h" |
21 #include "content/public/test/test_browser_context.h" | 20 #include "content/public/test/test_browser_context.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 MockRenderProcessHostFactory process_host_factory; | 124 MockRenderProcessHostFactory process_host_factory; |
126 RenderProcessHost* process_host = | 125 RenderProcessHost* process_host = |
127 process_host_factory.CreateRenderProcessHost(&browser_context, nullptr); | 126 process_host_factory.CreateRenderProcessHost(&browser_context, nullptr); |
128 | 127 |
129 // Populates |g_supported_scale_factors|. | 128 // Populates |g_supported_scale_factors|. |
130 std::vector<ui::ScaleFactor> supported_factors; | 129 std::vector<ui::ScaleFactor> supported_factors; |
131 supported_factors.push_back(ui::SCALE_FACTOR_100P); | 130 supported_factors.push_back(ui::SCALE_FACTOR_100P); |
132 ui::test::ScopedSetSupportedScaleFactors scoped_supported(supported_factors); | 131 ui::test::ScopedSetSupportedScaleFactors scoped_supported(supported_factors); |
133 | 132 |
134 base::mac::ScopedNSAutoreleasePool pool; | 133 base::mac::ScopedNSAutoreleasePool pool; |
135 base::MessageLoop message_loop; | 134 base::test::ScopedTaskEnvironment scoped_task_environment_; |
136 base::test::ScopedTaskScheduler task_scheduler(&message_loop); | |
137 | 135 |
138 int32_t routing_id = process_host->GetNextRoutingID(); | 136 int32_t routing_id = process_host->GetNextRoutingID(); |
139 RenderWidgetHostEditCommandCounter* render_widget = | 137 RenderWidgetHostEditCommandCounter* render_widget = |
140 new RenderWidgetHostEditCommandCounter(&delegate, process_host, | 138 new RenderWidgetHostEditCommandCounter(&delegate, process_host, |
141 routing_id); | 139 routing_id); |
142 | 140 |
143 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); | 141 ui::WindowResizeHelperMac::Get()->Init(base::ThreadTaskRunnerHandle::Get()); |
144 | 142 |
145 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa|. | 143 // Owned by its |cocoa_view()|, i.e. |rwhv_cocoa|. |
146 RenderWidgetHostViewMac* rwhv_mac = new RenderWidgetHostViewMac( | 144 RenderWidgetHostViewMac* rwhv_mac = new RenderWidgetHostViewMac( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 212 |
215 // Random selectors should be enabled by the function. | 213 // Random selectors should be enabled by the function. |
216 SEL garbage_selector = NSSelectorFromString(@"randomGarbageSelector:"); | 214 SEL garbage_selector = NSSelectorFromString(@"randomGarbageSelector:"); |
217 ASSERT_FALSE(helper.IsMenuItemEnabled(garbage_selector, rwhvm_owner)); | 215 ASSERT_FALSE(helper.IsMenuItemEnabled(garbage_selector, rwhvm_owner)); |
218 | 216 |
219 // TODO(jeremy): Currently IsMenuItemEnabled just returns true for all edit | 217 // TODO(jeremy): Currently IsMenuItemEnabled just returns true for all edit |
220 // selectors. Once we go past that we should do more extensive testing here. | 218 // selectors. Once we go past that we should do more extensive testing here. |
221 } | 219 } |
222 | 220 |
223 } // namespace content | 221 } // namespace content |
OLD | NEW |