OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
6 #include "cc/output/context_provider.h" | 6 #include "cc/output/context_provider.h" |
7 #include "content/browser/aura/image_transport_factory.h" | 7 #include "content/browser/compositor/image_transport_factory.h" |
8 #include "content/public/browser/gpu_data_manager.h" | 8 #include "content/public/browser/gpu_data_manager.h" |
9 #include "content/test/content_browser_test.h" | 9 #include "content/test/content_browser_test.h" |
10 #include "gpu/GLES2/gl2extchromium.h" | 10 #include "gpu/GLES2/gl2extchromium.h" |
11 #include "gpu/command_buffer/client/gles2_interface.h" | 11 #include "gpu/command_buffer/client/gles2_interface.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "ui/compositor/compositor.h" | 13 #include "ui/compositor/compositor.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 namespace { | 16 namespace { |
17 | 17 |
18 class ImageTransportFactoryBrowserTest : public ContentBrowserTest { | 18 class ImageTransportFactoryBrowserTest : public ContentBrowserTest { |
19 public: | 19 public: |
20 ImageTransportFactoryBrowserTest() {} | 20 ImageTransportFactoryBrowserTest() {} |
21 | 21 |
22 virtual void SetUp() OVERRIDE { | 22 virtual void SetUp() OVERRIDE { |
23 UseRealGLContexts(); | 23 UseRealGLContexts(); |
24 ContentBrowserTest::SetUp(); | 24 ContentBrowserTest::SetUp(); |
25 } | 25 } |
26 }; | 26 }; |
27 | 27 |
28 class MockImageTransportFactoryObserver : public ImageTransportFactoryObserver { | 28 class MockImageTransportFactoryObserver : public ImageTransportFactoryObserver { |
29 public: | 29 public: |
30 MOCK_METHOD0(OnLostResources, void()); | 30 MOCK_METHOD0(OnLostResources, void()); |
31 }; | 31 }; |
32 | 32 |
| 33 // This crashes on Mac ASAN |
| 34 // http://crbug.com/335083 |
| 35 #if defined(OS_MACOSX) |
| 36 #define MAYBE_TestLostContext DISABLED_TestLostContext |
| 37 #else |
| 38 #define MAYBE_TestLostContext TestLostContext |
| 39 #endif |
33 // Checks that upon context loss, the observer is called and the created | 40 // Checks that upon context loss, the observer is called and the created |
34 // resources are reset. | 41 // resources are reset. |
35 IN_PROC_BROWSER_TEST_F(ImageTransportFactoryBrowserTest, TestLostContext) { | 42 IN_PROC_BROWSER_TEST_F(ImageTransportFactoryBrowserTest, |
| 43 MAYBE_TestLostContext) { |
36 // This test doesn't make sense in software compositing mode. | 44 // This test doesn't make sense in software compositing mode. |
37 if (!GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) | 45 if (!GpuDataManager::GetInstance()->CanUseGpuBrowserCompositor()) |
38 return; | 46 return; |
39 | 47 |
40 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 48 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
41 scoped_refptr<ui::Texture> texture = factory->CreateTransportClient(1.f); | 49 scoped_refptr<ui::Texture> texture = factory->CreateTransportClient(1.f); |
42 ASSERT_TRUE(texture.get()); | 50 ASSERT_TRUE(texture.get()); |
43 | 51 |
44 MockImageTransportFactoryObserver observer; | 52 MockImageTransportFactoryObserver observer; |
45 factory->AddObserver(&observer); | 53 factory->AddObserver(&observer); |
(...skipping 14 matching lines...) Expand all Loading... |
60 gl->Flush(); | 68 gl->Flush(); |
61 | 69 |
62 run_loop.Run(); | 70 run_loop.Run(); |
63 EXPECT_EQ(0u, texture->PrepareTexture()); | 71 EXPECT_EQ(0u, texture->PrepareTexture()); |
64 | 72 |
65 factory->RemoveObserver(&observer); | 73 factory->RemoveObserver(&observer); |
66 } | 74 } |
67 | 75 |
68 } // anonymous namespace | 76 } // anonymous namespace |
69 } // namespace content | 77 } // namespace content |
OLD | NEW |