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

Side by Side Diff: content/browser/compositor/image_transport_factory_browsertest.cc

Issue 301233005: Removes useage of deprecated Compositor constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/compositor/browser_compositor_view_mac.mm ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 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 "content/browser/compositor/image_transport_factory.h"
6
5 #include "base/run_loop.h" 7 #include "base/run_loop.h"
6 #include "cc/output/context_provider.h" 8 #include "cc/output/context_provider.h"
7 #include "content/browser/compositor/image_transport_factory.h"
8 #include "content/browser/compositor/owned_mailbox.h" 9 #include "content/browser/compositor/owned_mailbox.h"
9 #include "content/public/browser/gpu_data_manager.h" 10 #include "content/public/browser/gpu_data_manager.h"
10 #include "content/public/test/content_browser_test.h" 11 #include "content/public/test/content_browser_test.h"
11 #include "gpu/GLES2/gl2extchromium.h" 12 #include "gpu/GLES2/gl2extchromium.h"
12 #include "gpu/command_buffer/client/gles2_interface.h" 13 #include "gpu/command_buffer/client/gles2_interface.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "ui/compositor/compositor.h" 15 #include "ui/compositor/compositor.h"
15 16
16 namespace content { 17 namespace content {
17 namespace { 18 namespace {
18 19
19 class ImageTransportFactoryBrowserTest : public ContentBrowserTest {}; 20 typedef ContentBrowserTest ImageTransportFactoryBrowserTest;
20 21
21 class MockImageTransportFactoryObserver : public ImageTransportFactoryObserver { 22 class MockImageTransportFactoryObserver : public ImageTransportFactoryObserver {
22 public: 23 public:
23 MOCK_METHOD0(OnLostResources, void()); 24 MOCK_METHOD0(OnLostResources, void());
24 }; 25 };
25 26
26 // This crashes on Mac ASAN 27 // This crashes on Mac ASAN
27 // http://crbug.com/335083 28 // http://crbug.com/335083
28 #if defined(OS_MACOSX) 29 #if defined(OS_MACOSX)
29 #define MAYBE_TestLostContext DISABLED_TestLostContext 30 #define MAYBE_TestLostContext DISABLED_TestLostContext
(...skipping 14 matching lines...) Expand all
44 new OwnedMailbox(factory->GetGLHelper()); 45 new OwnedMailbox(factory->GetGLHelper());
45 EXPECT_FALSE(mailbox->mailbox().IsZero()); 46 EXPECT_FALSE(mailbox->mailbox().IsZero());
46 47
47 MockImageTransportFactoryObserver observer; 48 MockImageTransportFactoryObserver observer;
48 factory->AddObserver(&observer); 49 factory->AddObserver(&observer);
49 50
50 base::RunLoop run_loop; 51 base::RunLoop run_loop;
51 EXPECT_CALL(observer, OnLostResources()) 52 EXPECT_CALL(observer, OnLostResources())
52 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 53 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
53 54
54 ui::ContextFactory* context_factory = ui::ContextFactory::GetInstance(); 55 ui::ContextFactory* context_factory = factory->GetContextFactory();
55 gpu::gles2::GLES2Interface* gl = 56 gpu::gles2::GLES2Interface* gl =
56 context_factory->SharedMainThreadContextProvider()->ContextGL(); 57 context_factory->SharedMainThreadContextProvider()->ContextGL();
57 gl->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, 58 gl->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
58 GL_INNOCENT_CONTEXT_RESET_ARB); 59 GL_INNOCENT_CONTEXT_RESET_ARB);
59 60
60 // We have to flush to make sure that the client side gets a chance to notice 61 // We have to flush to make sure that the client side gets a chance to notice
61 // the context is gone. 62 // the context is gone.
62 gl->Flush(); 63 gl->Flush();
63 64
64 run_loop.Run(); 65 run_loop.Run();
65 EXPECT_TRUE(mailbox->mailbox().IsZero()); 66 EXPECT_TRUE(mailbox->mailbox().IsZero());
66 67
67 factory->RemoveObserver(&observer); 68 factory->RemoveObserver(&observer);
68 } 69 }
69 70
70 } // anonymous namespace 71 } // anonymous namespace
71 } // namespace content 72 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/compositor/browser_compositor_view_mac.mm ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698