| 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 "content/shell/renderer/webkit_test_runner.h" | 5 #include "content/shell/renderer/webkit_test_runner.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <clocale> | 8 #include <clocale> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| 11 #include "base/base64.h" | 11 #include "base/base64.h" |
| 12 #include "base/command_line.h" |
| 12 #include "base/debug/debugger.h" | 13 #include "base/debug/debugger.h" |
| 13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 14 #include "base/md5.h" | 15 #include "base/md5.h" |
| 15 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
| 17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/sys_string_conversions.h" | 20 #include "base/strings/sys_string_conversions.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
| 23 #include "content/public/renderer/history_item_serialization.h" | 25 #include "content/public/renderer/history_item_serialization.h" |
| 24 #include "content/public/renderer/render_view.h" | 26 #include "content/public/renderer/render_view.h" |
| 25 #include "content/public/renderer/render_view_visitor.h" | 27 #include "content/public/renderer/render_view_visitor.h" |
| 26 #include "content/public/test/layouttest_support.h" | 28 #include "content/public/test/layouttest_support.h" |
| 27 #include "content/shell/common/shell_messages.h" | 29 #include "content/shell/common/shell_messages.h" |
| 28 #include "content/shell/common/webkit_test_helpers.h" | 30 #include "content/shell/common/webkit_test_helpers.h" |
| 29 #include "content/shell/renderer/shell_render_process_observer.h" | 31 #include "content/shell/renderer/shell_render_process_observer.h" |
| 30 #include "net/base/net_errors.h" | 32 #include "net/base/net_errors.h" |
| 31 #include "net/base/net_util.h" | 33 #include "net/base/net_util.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #endif | 112 #endif |
| 111 | 113 |
| 112 void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) { | 114 void CopyCanvasToBitmap(SkCanvas* canvas, SkBitmap* snapshot) { |
| 113 SkBaseDevice* device = skia::GetTopDevice(*canvas); | 115 SkBaseDevice* device = skia::GetTopDevice(*canvas); |
| 114 const SkBitmap& bitmap = device->accessBitmap(false); | 116 const SkBitmap& bitmap = device->accessBitmap(false); |
| 115 const bool success = bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config); | 117 const bool success = bitmap.copyTo(snapshot, SkBitmap::kARGB_8888_Config); |
| 116 DCHECK(success); | 118 DCHECK(success); |
| 117 | 119 |
| 118 #if !defined(OS_MACOSX) | 120 #if !defined(OS_MACOSX) |
| 119 // Only the expected PNGs for Mac have a valid alpha channel. | 121 // Only the expected PNGs for Mac have a valid alpha channel. |
| 120 MakeBitmapOpaque(snapshot); | 122 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 123 switches::kEnableOverlayFullscreenVideo)) |
| 124 MakeBitmapOpaque(snapshot); |
| 121 #endif | 125 #endif |
| 122 } | 126 } |
| 123 | 127 |
| 124 class SyncNavigationStateVisitor : public RenderViewVisitor { | 128 class SyncNavigationStateVisitor : public RenderViewVisitor { |
| 125 public: | 129 public: |
| 126 SyncNavigationStateVisitor() {} | 130 SyncNavigationStateVisitor() {} |
| 127 virtual ~SyncNavigationStateVisitor() {} | 131 virtual ~SyncNavigationStateVisitor() {} |
| 128 | 132 |
| 129 virtual bool Visit(RenderView* render_view) OVERRIDE { | 133 virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 130 SyncNavigationState(render_view); | 134 SyncNavigationState(render_view); |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 WebURLRequest(GURL(kAboutBlankURL))); | 685 WebURLRequest(GURL(kAboutBlankURL))); |
| 682 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 686 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
| 683 } | 687 } |
| 684 | 688 |
| 685 void WebKitTestRunner::OnNotifyDone() { | 689 void WebKitTestRunner::OnNotifyDone() { |
| 686 render_view()->GetWebView()->mainFrame()->executeScript( | 690 render_view()->GetWebView()->mainFrame()->executeScript( |
| 687 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 691 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
| 688 } | 692 } |
| 689 | 693 |
| 690 } // namespace content | 694 } // namespace content |
| OLD | NEW |