Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Issue 8240006: Use a mocked compositor for unit tests (Closed)

Created:
9 years, 2 months ago by jonathan.backer
Modified:
9 years, 2 months ago
CC:
chromium-reviews, rjkroege
Visibility:
Public.

Description

ui::TestCompositor::TestCompositor() constructor has been changed to take a a CompositorDelegate* as a parameter. It can be NULL to get the same behaviour as before. But some tests actually require ScheduleDraw() to cause a draw to happen, in order to test that their real delegate is doing its job. Also, we move the compositor_factory from views::Widget and aura::Desktop to ui::Compositor. BUG=101091 TEST=bots stay green Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=107103

Patch Set 1 #

Patch Set 2 : mocked #

Patch Set 3 : #ifdef #

Patch Set 4 : 1 #

Patch Set 5 : fixing trybots #

Patch Set 6 : rm unneeded change #

Patch Set 7 : cleanup #

Total comments: 8

Patch Set 8 : move the compositor factory from views::Widget to ui::Compositor #

Patch Set 9 : 1 #

Patch Set 10 : extra .h #

Patch Set 11 : leftover #

Patch Set 12 : try again? diffs broke #

Patch Set 13 : missed views_test_base.cc #

Total comments: 6

Patch Set 14 : testsuite subclasses #

Total comments: 4

Patch Set 15 : nits and compile fixes #

Patch Set 16 : aura compile fix #

Patch Set 17 : ui/gfx/test/gfx_test_utils #

Patch Set 18 : ui/gfx/test/gfx_test_utils x2 #

Patch Set 19 : ui/gfx/test/gfx_test_utils x3 #

Patch Set 20 : ui/gfx/test/gfx_test_utils x4 #

Total comments: 5

Patch Set 21 : "" #

Patch Set 22 : Merge #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+97 lines, -85 lines) Patch
M chrome/browser/gpu_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -2 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -0 lines 1 comment Download
M chrome/test/base/chrome_test_suite.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +3 lines, -8 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -0 lines 0 comments Download
M content/test/content_test_suite.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +4 lines, -0 lines 0 comments Download
M ui/aura/desktop.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +0 lines, -10 lines 0 comments Download
M ui/aura/desktop.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +2 lines, -5 lines 0 comments Download
M ui/aura/test/aura_test_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +0 lines, -7 lines 0 comments Download
M ui/aura/test/test_suite.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -0 lines 0 comments Download
M ui/aura_shell/test_suite.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +1 line, -4 lines 0 comments Download
M ui/gfx/compositor/compositor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +16 lines, -0 lines 0 comments Download
M ui/gfx/compositor/compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +3 lines, -0 lines 0 comments Download
M ui/gfx/compositor/compositor.gyp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 3 chunks +18 lines, -6 lines 2 comments Download
M ui/gfx/compositor/compositor_test_support.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +5 lines, -0 lines 0 comments Download
M ui/gfx/compositor/compositor_test_support.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +20 lines, -0 lines 0 comments Download
M ui/gfx/compositor/layer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -1 line 0 comments Download
M ui/gfx/compositor/test_compositor.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +4 lines, -1 line 0 comments Download
M ui/gfx/compositor/test_compositor.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2 chunks +9 lines, -3 lines 0 comments Download
M views/run_all_unittests.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +1 line, -4 lines 0 comments Download
M views/test/views_test_base.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +0 lines, -15 lines 0 comments Download
M views/widget/native_widget_gtk.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +2 lines, -2 lines 0 comments Download
M views/widget/native_widget_wayland.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -2 lines 0 comments Download
M views/widget/native_widget_win.cc View 1 2 3 4 5 6 7 1 chunk +2 lines, -2 lines 0 comments Download
M views/widget/widget.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +0 lines, -10 lines 0 comments Download
M views/widget/widget.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +0 lines, -3 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
danakj
cheers.
9 years, 2 months ago (2011-10-13 16:04:49 UTC) #1
sky
http://codereview.chromium.org/8240006/diff/4018/chrome/chrome_tests.gypi File chrome/chrome_tests.gypi (right): http://codereview.chromium.org/8240006/diff/4018/chrome/chrome_tests.gypi#newcode236 chrome/chrome_tests.gypi:236: '../views/widget/widget.h', Ugh. I don't like pulling in widget here. ...
9 years, 2 months ago (2011-10-13 19:51:59 UTC) #2
Paweł Hajdan Jr.
http://codereview.chromium.org/8240006/diff/4018/chrome/test/base/in_process_browser_test.cc File chrome/test/base/in_process_browser_test.cc (right): http://codereview.chromium.org/8240006/diff/4018/chrome/test/base/in_process_browser_test.cc#newcode146 chrome/test/base/in_process_browser_test.cc:146: test_launcher_utils::OverrideGLImplementation( Do you also want things to apply to ...
9 years, 2 months ago (2011-10-13 20:08:13 UTC) #3
danakj
Thanks for the feedback. 1) Moved the compositor_factory_ from views::Widget and aura::Desktop to ui::Compositor. - ...
9 years, 2 months ago (2011-10-14 15:15:13 UTC) #4
sky
http://codereview.chromium.org/8240006/diff/15001/content/browser/renderer_host/render_widget_host_unittest.cc File content/browser/renderer_host/render_widget_host_unittest.cc (right): http://codereview.chromium.org/8240006/diff/15001/content/browser/renderer_host/render_widget_host_unittest.cc#newcode245 content/browser/renderer_host/render_widget_host_unittest.cc:245: #if defined(VIEWS_COMPOSITOR) I was wrong in where I put ...
9 years, 2 months ago (2011-10-14 17:07:16 UTC) #5
jonathan.backer
http://codereview.chromium.org/8240006/diff/15001/chrome/chrome_tests.gypi File chrome/chrome_tests.gypi (right): http://codereview.chromium.org/8240006/diff/15001/chrome/chrome_tests.gypi#newcode239 chrome/chrome_tests.gypi:239: '../ui/gfx/compositor/test_texture.h', Shouldn't these be pulled in from a dep ...
9 years, 2 months ago (2011-10-14 17:53:17 UTC) #6
danakj
http://codereview.chromium.org/8240006/diff/15001/chrome/chrome_tests.gypi File chrome/chrome_tests.gypi (right): http://codereview.chromium.org/8240006/diff/15001/chrome/chrome_tests.gypi#newcode239 chrome/chrome_tests.gypi:239: '../ui/gfx/compositor/test_texture.h', On 2011/10/14 17:53:17, jonathan.backer wrote: > Shouldn't these ...
9 years, 2 months ago (2011-10-14 19:51:38 UTC) #7
sky
LGTM http://codereview.chromium.org/8240006/diff/17002/chrome/test/base/chrome_test_suite.cc File chrome/test/base/chrome_test_suite.cc (right): http://codereview.chromium.org/8240006/diff/17002/chrome/test/base/chrome_test_suite.cc#newcode175 chrome/test/base/chrome_test_suite.cc:175: #if defined(OS_LINUX) #elif http://codereview.chromium.org/8240006/diff/17002/ui/gfx/compositor/compositor.h File ui/gfx/compositor/compositor.h (right): http://codereview.chromium.org/8240006/diff/17002/ui/gfx/compositor/compositor.h#newcode146 ...
9 years, 2 months ago (2011-10-14 20:52:41 UTC) #8
danakj
http://codereview.chromium.org/8240006/diff/17002/chrome/test/base/chrome_test_suite.cc File chrome/test/base/chrome_test_suite.cc (right): http://codereview.chromium.org/8240006/diff/17002/chrome/test/base/chrome_test_suite.cc#newcode175 chrome/test/base/chrome_test_suite.cc:175: #if defined(OS_LINUX) On 2011/10/14 20:52:41, sky wrote: > #elif ...
9 years, 2 months ago (2011-10-17 14:52:13 UTC) #9
Paweł Hajdan Jr.
I think this new approach still fails to make the switches apply for content/ right?
9 years, 2 months ago (2011-10-18 10:04:32 UTC) #10
danakj
On 2011/10/18 10:04:32, Paweł Hajdan Jr. wrote: > I think this new approach still fails ...
9 years, 2 months ago (2011-10-18 13:16:57 UTC) #11
danakj
9 years, 2 months ago (2011-10-18 13:17:11 UTC) #12
Paweł Hajdan Jr.
On 2011/10/18 13:16:57, danakj wrote: > On 2011/10/18 10:04:32, Paweł Hajdan Jr. wrote: > > ...
9 years, 2 months ago (2011-10-18 13:21:34 UTC) #13
danakj
On 2011/10/18 13:21:34, Paweł Hajdan Jr. wrote: > On 2011/10/18 13:16:57, danakj wrote: > > ...
9 years, 2 months ago (2011-10-18 13:47:21 UTC) #14
Paweł Hajdan Jr.
On 2011/10/18 13:47:21, danakj wrote: > On 2011/10/18 13:21:34, Paweł Hajdan Jr. wrote: > > ...
9 years, 2 months ago (2011-10-18 13:51:54 UTC) #15
danakj
On 2011/10/18 13:51:54, Paweł Hajdan Jr. wrote: > On 2011/10/18 13:47:21, danakj wrote: > > ...
9 years, 2 months ago (2011-10-18 14:49:47 UTC) #16
Paweł Hajdan Jr.
http://codereview.chromium.org/8240006/diff/32027/ui/gfx/test/gfx_test_utils.cc File ui/gfx/test/gfx_test_utils.cc (right): http://codereview.chromium.org/8240006/diff/32027/ui/gfx/test/gfx_test_utils.cc#newcode22 ui/gfx/test/gfx_test_utils.cc:22: EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)); Please convert it so that the function returns ...
9 years, 2 months ago (2011-10-19 08:49:37 UTC) #17
danakj
http://codereview.chromium.org/8240006/diff/32027/ui/gfx/test/gfx_test_utils.cc File ui/gfx/test/gfx_test_utils.cc (right): http://codereview.chromium.org/8240006/diff/32027/ui/gfx/test/gfx_test_utils.cc#newcode22 ui/gfx/test/gfx_test_utils.cc:22: EXPECT_TRUE(!CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseGL)); On 2011/10/19 08:49:37, Paweł Hajdan Jr. wrote: > ...
9 years, 2 months ago (2011-10-19 13:55:48 UTC) #18
jonathan.backer
Taking over from Dana. I trimmed this down and tried to move unnecessary/contentious parts to ...
9 years, 2 months ago (2011-10-20 22:19:59 UTC) #19
piman
Couple of comments while trying to look at http://code.google.com/p/chromium/issues/detail?id=101477 http://codereview.chromium.org/8240006/diff/53001/chrome/chrome_tests.gypi File chrome/chrome_tests.gypi (right): http://codereview.chromium.org/8240006/diff/53001/chrome/chrome_tests.gypi#newcode66 chrome/chrome_tests.gypi:66: ...
9 years, 2 months ago (2011-10-25 18:06:51 UTC) #20
jonathan.backer
http://codereview.chromium.org/8240006/diff/53001/ui/gfx/compositor/compositor.gyp File ui/gfx/compositor/compositor.gyp (right): http://codereview.chromium.org/8240006/diff/53001/ui/gfx/compositor/compositor.gyp#newcode119 ui/gfx/compositor/compositor.gyp:119: 'compositor.cc', The idea is to avoid pulling in the ...
9 years, 2 months ago (2011-10-25 20:10:09 UTC) #21
piman
9 years, 2 months ago (2011-10-25 20:31:12 UTC) #22
On Tue, Oct 25, 2011 at 1:10 PM, <backer@chromium.org> wrote:

>
> http://codereview.chromium.**org/8240006/diff/53001/ui/gfx/**
>
compositor/compositor.gyp<http://codereview.chromium.org/8240006/diff/53001/ui/gfx/compositor/compositor.gyp>
> File ui/gfx/compositor/compositor.**gyp (right):
>
> http://codereview.chromium.**org/8240006/diff/53001/ui/gfx/**
>
compositor/compositor.gyp#**newcode119<http://codereview.chromium.org/8240006/diff/53001/ui/gfx/compositor/compositor.gyp#newcode119>
> ui/gfx/compositor/compositor.**gyp:119: 'compositor.cc',
> The idea is to avoid pulling in the actual implementations. AFAIK, most
> of the places where this is used, we're using a mock compositor. There
> are one or two exceptions (aura_test_shell?) where it is used to
> initialize WK and use a real compositor. These use cases depend on both
> compositor and compositor_test_support.
>
> I'd like to keep the separate, because it may be possible to lose the WK
> dependency for test if we can get a test Layer implementation.
>

When I created that target, the whole point was to be able to pull the WK
dependency in a way that was convenient (i.e. not add a bunch of ifdefs
everywhere).
Also, as I mentioned above, you can't depend on this and renderer at the
same time and expect it to work (webkit_support is mutually exclusive with
it).
Also, I'm really surprised you can link both compositor and this, since it
duplicates objects (especially in the shared build), that are compiled with
different flags (some with COMPOSITOR_IMPLEMENTATION and some without). That
violate the "one definition rule", and I think that's wrong.

I'm not sure I understand which problem we're trying to solve by "avoid
pulling in the actual implementations".
Even if that's something that's desirable, we should do it by having a
target that has compositor.cc and layer.cc and another target that has the
implementations.


>
>
http://codereview.chromium.**org/8240006/<http://codereview.chromium.org/8240...
>

Powered by Google App Engine
This is Rietveld 408576698