| 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 #include "webkit/support/webkit_support.h" | 5 #include "webkit/support/webkit_support.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 using WebKit::WebCString; | 67 using WebKit::WebCString; |
| 68 using WebKit::WebDevToolsAgentClient; | 68 using WebKit::WebDevToolsAgentClient; |
| 69 using WebKit::WebFileSystem; | 69 using WebKit::WebFileSystem; |
| 70 using WebKit::WebFileSystemCallbacks; | 70 using WebKit::WebFileSystemCallbacks; |
| 71 using WebKit::WebFrame; | 71 using WebKit::WebFrame; |
| 72 using WebKit::WebMediaPlayerClient; | 72 using WebKit::WebMediaPlayerClient; |
| 73 using WebKit::WebPlugin; | 73 using WebKit::WebPlugin; |
| 74 using WebKit::WebPluginParams; | 74 using WebKit::WebPluginParams; |
| 75 using WebKit::WebString; | 75 using WebKit::WebString; |
| 76 using WebKit::WebURL; | 76 using WebKit::WebURL; |
| 77 using webkit::gpu::WebGraphicsContext3DInProcessImpl; |
| 78 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 77 | 79 |
| 78 namespace { | 80 namespace { |
| 79 | 81 |
| 80 // All fatal log messages (e.g. DCHECK failures) imply unit test failures | 82 // All fatal log messages (e.g. DCHECK failures) imply unit test failures |
| 81 void UnitTestAssertHandler(const std::string& str) { | 83 void UnitTestAssertHandler(const std::string& str) { |
| 82 FAIL() << str; | 84 FAIL() << str; |
| 83 } | 85 } |
| 84 | 86 |
| 85 void InitLogging(bool enable_gp_fault_error_box) { | 87 void InitLogging(bool enable_gp_fault_error_box) { |
| 86 logging::SetLogAssertHandler(UnitTestAssertHandler); | 88 logging::SetLogAssertHandler(UnitTestAssertHandler); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 367 } |
| 366 | 368 |
| 367 GraphicsContext3DImplementation GetGraphicsContext3DImplementation() { | 369 GraphicsContext3DImplementation GetGraphicsContext3DImplementation() { |
| 368 return g_graphics_context_3d_implementation; | 370 return g_graphics_context_3d_implementation; |
| 369 } | 371 } |
| 370 | 372 |
| 371 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( | 373 WebKit::WebGraphicsContext3D* CreateGraphicsContext3D( |
| 372 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 374 const WebKit::WebGraphicsContext3D::Attributes& attributes, |
| 373 WebKit::WebView* web_view, | 375 WebKit::WebView* web_view, |
| 374 bool direct) { | 376 bool direct) { |
| 375 scoped_ptr<WebKit::WebGraphicsContext3D> context; | |
| 376 switch (webkit_support::GetGraphicsContext3DImplementation()) { | 377 switch (webkit_support::GetGraphicsContext3DImplementation()) { |
| 377 case webkit_support::IN_PROCESS: | 378 case webkit_support::IN_PROCESS: |
| 378 context.reset(new webkit::gpu::WebGraphicsContext3DInProcessImpl( | 379 return WebGraphicsContext3DInProcessImpl::CreateForWebView( |
| 379 gfx::kNullPluginWindow, NULL)); | 380 attributes, web_view, direct); |
| 380 break; | 381 case webkit_support::IN_PROCESS_COMMAND_BUFFER: { |
| 381 case webkit_support::IN_PROCESS_COMMAND_BUFFER: | 382 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context( |
| 382 context.reset( | 383 new WebGraphicsContext3DInProcessCommandBufferImpl()); |
| 383 new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl()); | 384 if (!context->initialize(attributes, web_view, direct)) |
| 384 break; | 385 return NULL; |
| 386 return context.release(); |
| 387 } |
| 385 } | 388 } |
| 386 if (!context->initialize(attributes, web_view, direct)) | 389 NOTREACHED(); |
| 387 return NULL; | 390 return NULL; |
| 388 return context.release(); | |
| 389 } | 391 } |
| 390 | 392 |
| 391 void RegisterMockedURL(const WebKit::WebURL& url, | 393 void RegisterMockedURL(const WebKit::WebURL& url, |
| 392 const WebKit::WebURLResponse& response, | 394 const WebKit::WebURLResponse& response, |
| 393 const WebKit::WebString& file_path) { | 395 const WebKit::WebString& file_path) { |
| 394 test_environment->webkit_platform_support()->url_loader_factory()-> | 396 test_environment->webkit_platform_support()->url_loader_factory()-> |
| 395 RegisterURL(url, response, file_path); | 397 RegisterURL(url, response, file_path); |
| 396 } | 398 } |
| 397 | 399 |
| 398 void UnregisterMockedURL(const WebKit::WebURL& url) { | 400 void UnregisterMockedURL(const WebKit::WebURL& url) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 // Logging | 674 // Logging |
| 673 void EnableWebCoreLogChannels(const std::string& channels) { | 675 void EnableWebCoreLogChannels(const std::string& channels) { |
| 674 webkit_glue::EnableWebCoreLogChannels(channels); | 676 webkit_glue::EnableWebCoreLogChannels(channels); |
| 675 } | 677 } |
| 676 | 678 |
| 677 void SetGamepadData(const WebKit::WebGamepads& pads) { | 679 void SetGamepadData(const WebKit::WebGamepads& pads) { |
| 678 test_environment->webkit_platform_support()->setGamepadData(pads); | 680 test_environment->webkit_platform_support()->setGamepadData(pads); |
| 679 } | 681 } |
| 680 | 682 |
| 681 } // namespace webkit_support | 683 } // namespace webkit_support |
| OLD | NEW |