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

Side by Side Diff: content/shell/test_runner/test_runner_for_specific_view.cc

Issue 2707183003: Move //components/test_runner back into //content/shell (Closed)
Patch Set: Trim DEPS Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/test_runner/test_runner_for_specific_view.h" 5 #include "content/shell/test_runner/test_runner_for_specific_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "components/test_runner/layout_and_paint_async_then.h" 17 #include "content/shell/test_runner/layout_and_paint_async_then.h"
18 #include "components/test_runner/layout_dump.h" 18 #include "content/shell/test_runner/layout_dump.h"
19 #include "components/test_runner/mock_content_settings_client.h" 19 #include "content/shell/test_runner/mock_content_settings_client.h"
20 #include "components/test_runner/mock_credential_manager_client.h" 20 #include "content/shell/test_runner/mock_credential_manager_client.h"
21 #include "components/test_runner/mock_screen_orientation_client.h" 21 #include "content/shell/test_runner/mock_screen_orientation_client.h"
22 #include "components/test_runner/mock_web_speech_recognizer.h" 22 #include "content/shell/test_runner/mock_web_speech_recognizer.h"
23 #include "components/test_runner/mock_web_user_media_client.h" 23 #include "content/shell/test_runner/mock_web_user_media_client.h"
24 #include "components/test_runner/pixel_dump.h" 24 #include "content/shell/test_runner/pixel_dump.h"
25 #include "components/test_runner/spell_check_client.h" 25 #include "content/shell/test_runner/spell_check_client.h"
26 #include "components/test_runner/test_common.h" 26 #include "content/shell/test_runner/test_common.h"
27 #include "components/test_runner/test_interfaces.h" 27 #include "content/shell/test_runner/test_interfaces.h"
28 #include "components/test_runner/test_preferences.h" 28 #include "content/shell/test_runner/test_preferences.h"
29 #include "components/test_runner/test_runner.h" 29 #include "content/shell/test_runner/test_runner.h"
30 #include "components/test_runner/web_test_delegate.h" 30 #include "content/shell/test_runner/web_test_delegate.h"
31 #include "components/test_runner/web_view_test_proxy.h" 31 #include "content/shell/test_runner/web_view_test_proxy.h"
32 #include "gin/arguments.h" 32 #include "gin/arguments.h"
33 #include "gin/array_buffer.h" 33 #include "gin/array_buffer.h"
34 #include "gin/handle.h" 34 #include "gin/handle.h"
35 #include "gin/object_template_builder.h" 35 #include "gin/object_template_builder.h"
36 #include "gin/wrappable.h" 36 #include "gin/wrappable.h"
37 #include "third_party/WebKit/public/platform/WebCanvas.h" 37 #include "third_party/WebKit/public/platform/WebCanvas.h"
38 #include "third_party/WebKit/public/platform/WebData.h" 38 #include "third_party/WebKit/public/platform/WebData.h"
39 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" 39 #include "third_party/WebKit/public/platform/WebPasswordCredential.h"
40 #include "third_party/WebKit/public/platform/WebPoint.h" 40 #include "third_party/WebKit/public/platform/WebPoint.h"
41 #include "third_party/WebKit/public/platform/WebURLResponse.h" 41 #include "third_party/WebKit/public/platform/WebURLResponse.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 pointer_locked_ = false; 92 pointer_locked_ = false;
93 pointer_lock_planned_result_ = PointerLockWillSucceed; 93 pointer_lock_planned_result_ = PointerLockWillSucceed;
94 94
95 if (web_view() && web_view()->mainFrame()) { 95 if (web_view() && web_view()->mainFrame()) {
96 RemoveWebPageOverlay(); 96 RemoveWebPageOverlay();
97 SetTabKeyCyclesThroughElements(true); 97 SetTabKeyCyclesThroughElements(true);
98 98
99 #if !defined(OS_MACOSX) && !defined(OS_WIN) 99 #if !defined(OS_MACOSX) && !defined(OS_WIN)
100 // (Constants copied because we can't depend on the header that defined 100 // (Constants copied because we can't depend on the header that defined
101 // them from this file.) 101 // them from this file.)
102 web_view()->setSelectionColors( 102 web_view()->setSelectionColors(0xff1e90ff, 0xff000000, 0xffc8c8c8,
103 0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232); 103 0xff323232);
104 #endif 104 #endif
105 web_view()->setVisibilityState(WebPageVisibilityStateVisible, true); 105 web_view()->setVisibilityState(WebPageVisibilityStateVisible, true);
106 if (web_view()->mainFrame()->isWebLocalFrame()) { 106 if (web_view()->mainFrame()->isWebLocalFrame()) {
107 web_view()->mainFrame()->enableViewSourceMode(false); 107 web_view()->mainFrame()->enableViewSourceMode(false);
108 web_view()->setTextZoomFactor(1); 108 web_view()->setTextZoomFactor(1);
109 web_view()->setZoomLevel(0); 109 web_view()->setZoomLevel(0);
110 } 110 }
111 } 111 }
112 } 112 }
113 113
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 int height = snapshot.info().height(); 265 int height = snapshot.info().height();
266 argv[1] = v8::Number::New(isolate, height); 266 argv[1] = v8::Number::New(isolate, height);
267 267
268 // Skia's internal byte order is platform-dependent. Always convert to RGBA 268 // Skia's internal byte order is platform-dependent. Always convert to RGBA
269 // in order to provide a consistent ordering to the layout tests. 269 // in order to provide a consistent ordering to the layout tests.
270 const SkImageInfo bufferInfo = 270 const SkImageInfo bufferInfo =
271 snapshot.info().makeColorType(kRGBA_8888_SkColorType); 271 snapshot.info().makeColorType(kRGBA_8888_SkColorType);
272 const size_t bufferRowBytes = bufferInfo.minRowBytes(); 272 const size_t bufferRowBytes = bufferInfo.minRowBytes();
273 blink::WebArrayBuffer buffer = 273 blink::WebArrayBuffer buffer =
274 blink::WebArrayBuffer::create(bufferInfo.getSafeSize(bufferRowBytes), 1); 274 blink::WebArrayBuffer::create(bufferInfo.getSafeSize(bufferRowBytes), 1);
275 if (!snapshot.readPixels(bufferInfo, 275 if (!snapshot.readPixels(bufferInfo, buffer.data(), bufferRowBytes, 0, 0)) {
276 buffer.data(),
277 bufferRowBytes,
278 0, 0)) {
279 // We only expect readPixels to fail for null bitmaps. 276 // We only expect readPixels to fail for null bitmaps.
280 DCHECK(snapshot.isNull()); 277 DCHECK(snapshot.isNull());
281 } 278 }
282 279
283 argv[2] = blink::WebArrayBufferConverter::toV8Value( 280 argv[2] = blink::WebArrayBufferConverter::toV8Value(
284 &buffer, context->Global(), isolate); 281 &buffer, context->Global(), isolate);
285 282
286 PostV8CallbackWithArgs(std::move(callback), arraysize(argv), argv); 283 PostV8CallbackWithArgs(std::move(callback), arraysize(argv), argv);
287 } 284 }
288 285
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 bool TestRunnerForSpecificView::HasCustomPageSizeStyle(int page_index) { 454 bool TestRunnerForSpecificView::HasCustomPageSizeStyle(int page_index) {
458 // TODO(dcheng): This class has many implicit assumptions that the frames it 455 // TODO(dcheng): This class has many implicit assumptions that the frames it
459 // operates on are always local. 456 // operates on are always local.
460 WebFrame* frame = web_view()->mainFrame(); 457 WebFrame* frame = web_view()->mainFrame();
461 if (!frame || frame->isWebRemoteFrame()) 458 if (!frame || frame->isWebRemoteFrame())
462 return false; 459 return false;
463 return frame->toWebLocalFrame()->hasCustomPageSizeStyle(page_index); 460 return frame->toWebLocalFrame()->hasCustomPageSizeStyle(page_index);
464 } 461 }
465 462
466 void TestRunnerForSpecificView::ForceRedSelectionColors() { 463 void TestRunnerForSpecificView::ForceRedSelectionColors() {
467 web_view()->setSelectionColors( 464 web_view()->setSelectionColors(0xffee0000, 0xff00ee00, 0xff000000,
468 0xffee0000, 0xff00ee00, 0xff000000, 0xffc0c0c0); 465 0xffc0c0c0);
469 } 466 }
470 467
471 void TestRunnerForSpecificView::SetPageVisibility( 468 void TestRunnerForSpecificView::SetPageVisibility(
472 const std::string& new_visibility) { 469 const std::string& new_visibility) {
473 if (new_visibility == "visible") 470 if (new_visibility == "visible")
474 web_view()->setVisibilityState(WebPageVisibilityStateVisible, false); 471 web_view()->setVisibilityState(WebPageVisibilityStateVisible, false);
475 else if (new_visibility == "hidden") 472 else if (new_visibility == "hidden")
476 web_view()->setVisibilityState(WebPageVisibilityStateHidden, false); 473 web_view()->setVisibilityState(WebPageVisibilityStateHidden, false);
477 else if (new_visibility == "prerender") 474 else if (new_visibility == "prerender")
478 web_view()->setVisibilityState(WebPageVisibilityStatePrerender, false); 475 web_view()->setVisibilityState(WebPageVisibilityStatePrerender, false);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 688
692 blink::WebView* TestRunnerForSpecificView::web_view() { 689 blink::WebView* TestRunnerForSpecificView::web_view() {
693 return web_view_test_proxy_base_->web_view(); 690 return web_view_test_proxy_base_->web_view();
694 } 691 }
695 692
696 WebTestDelegate* TestRunnerForSpecificView::delegate() { 693 WebTestDelegate* TestRunnerForSpecificView::delegate() {
697 return web_view_test_proxy_base_->delegate(); 694 return web_view_test_proxy_base_->delegate();
698 } 695 }
699 696
700 } // namespace test_runner 697 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698