Index: sky/viewer/viewer.cc |
diff --git a/sky/viewer/viewer.cc b/sky/viewer/viewer.cc |
index eb5b6d0fba31b3bb14f243cf89fbfd4146359401..4c5dd74eb292dcbce3c546cbebbf0f1e8432948f 100644 |
--- a/sky/viewer/viewer.cc |
+++ b/sky/viewer/viewer.cc |
@@ -13,6 +13,8 @@ |
#include "mojo/public/cpp/application/application_impl.h" |
#include "mojo/public/cpp/application/interface_factory_impl.h" |
#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h" |
+#include "sky/compositor/display_delegate_bitmap.h" |
+#include "sky/compositor/display_delegate_ganesh.h" |
#include "sky/engine/public/web/Sky.h" |
#include "sky/viewer/content_handler_impl.h" |
#include "sky/viewer/document_view.h" |
@@ -24,6 +26,9 @@ |
namespace sky { |
+// Load the viewer in testing mode so we can dump pixels. |
+const char kTesting[] = "--testing"; |
+ |
class Viewer : public mojo::ApplicationDelegate, |
public mojo::InterfaceFactory<mojo::ContentHandler> { |
public: |
@@ -34,6 +39,14 @@ class Viewer : public mojo::ApplicationDelegate, |
private: |
// Overridden from ApplicationDelegate: |
virtual void Initialize(mojo::ApplicationImpl* app) override { |
+ if (app->HasArg(kTesting)) { |
+ DisplayDelegate::setDisplayDelegateCreateFunction( |
+ DisplayDelegateBitmap::create); |
+ } else { |
+ DisplayDelegate::setDisplayDelegateCreateFunction( |
+ DisplayDelegateGanesh::create); |
+ } |
+ |
platform_impl_.reset(new PlatformImpl(app)); |
blink::initialize(platform_impl_.get()); |
base::i18n::InitializeICU(); |