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

Side by Side Diff: content/shell/browser/layout_test/blink_test_controller.cc

Issue 2759803002: Layout tests: Enable fetching generated files from the build directory (Closed)
Patch Set: . Created 3 years, 9 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
« no previous file with comments | « no previous file | content/shell/common/layout_test.mojom » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/layout_test/blink_test_controller.h" 5 #include "content/shell/browser/layout_test/blink_test_controller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <iostream> 9 #include <iostream>
10 #include <set> 10 #include <set>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/base64.h" 13 #include "base/base64.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/logging.h" 17 #include "base/logging.h"
18 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
19 #include "base/path_service.h"
19 #include "base/run_loop.h" 20 #include "base/run_loop.h"
20 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
21 #include "base/stl_util.h" 22 #include "base/stl_util.h"
22 #include "base/strings/string_number_conversions.h" 23 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
24 #include "base/threading/thread_task_runner_handle.h" 25 #include "base/threading/thread_task_runner_handle.h"
25 #include "build/build_config.h" 26 #include "build/build_config.h"
26 #include "content/public/browser/devtools_agent_host.h" 27 #include "content/public/browser/devtools_agent_host.h"
27 #include "content/public/browser/dom_storage_context.h" 28 #include "content/public/browser/dom_storage_context.h"
28 #include "content/public/browser/gpu_data_manager.h" 29 #include "content/public/browser/gpu_data_manager.h"
(...skipping 19 matching lines...) Expand all
48 #include "content/shell/browser/shell.h" 49 #include "content/shell/browser/shell.h"
49 #include "content/shell/browser/shell_browser_context.h" 50 #include "content/shell/browser/shell_browser_context.h"
50 #include "content/shell/browser/shell_content_browser_client.h" 51 #include "content/shell/browser/shell_content_browser_client.h"
51 #include "content/shell/browser/shell_devtools_frontend.h" 52 #include "content/shell/browser/shell_devtools_frontend.h"
52 #include "content/shell/common/layout_test/layout_test_messages.h" 53 #include "content/shell/common/layout_test/layout_test_messages.h"
53 #include "content/shell/common/layout_test/layout_test_switches.h" 54 #include "content/shell/common/layout_test/layout_test_switches.h"
54 #include "content/shell/common/shell_messages.h" 55 #include "content/shell/common/shell_messages.h"
55 #include "content/shell/renderer/layout_test/blink_test_helpers.h" 56 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
56 #include "ui/gfx/codec/png_codec.h" 57 #include "ui/gfx/codec/png_codec.h"
57 58
59 #if defined(OS_MACOSX)
60 #include "base/mac/foundation_util.h"
61 #endif
62
58 namespace content { 63 namespace content {
59 64
60 namespace { 65 namespace {
61 66
62 const int kTestSVGWindowWidthDip = 480; 67 const int kTestSVGWindowWidthDip = 480;
63 const int kTestSVGWindowHeightDip = 360; 68 const int kTestSVGWindowHeightDip = 360;
64 69
70 base::FilePath GetBuildDirectory() {
71 base::FilePath result;
72 base::PathService::Get(base::DIR_EXE, &result);
73
74 #if defined(OS_MACOSX)
75 if (base::mac::AmIBundled()) {
76 // The bundled app executables (Chromium, TestShell, etc) live three
77 // levels down from the build directory, eg:
78 // Chromium.app/Contents/MacOS/Chromium
79 result = result.DirName().DirName().DirName();
80 }
81 #endif
82 return result;
83 }
84
65 } // namespace 85 } // namespace
66 86
67 // BlinkTestResultPrinter ---------------------------------------------------- 87 // BlinkTestResultPrinter ----------------------------------------------------
68 88
69 BlinkTestResultPrinter::BlinkTestResultPrinter(std::ostream* output, 89 BlinkTestResultPrinter::BlinkTestResultPrinter(std::ostream* output,
70 std::ostream* error) 90 std::ostream* error)
71 : state_(DURING_TEST), 91 : state_(DURING_TEST),
72 capture_text_only_(false), 92 capture_text_only_(false),
73 encode_binary_data_(false), 93 encode_binary_data_(false),
74 output_(output), 94 output_(output),
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 !base::ContainsKey(main_window_render_process_hosts_, process)) { 631 !base::ContainsKey(main_window_render_process_hosts_, process)) {
612 main_window_render_process_hosts_.insert(process); 632 main_window_render_process_hosts_.insert(process);
613 633
614 // Make sure the new renderer process has a test configuration shared with 634 // Make sure the new renderer process has a test configuration shared with
615 // other renderers. 635 // other renderers.
616 mojom::ShellTestConfigurationPtr params = 636 mojom::ShellTestConfigurationPtr params =
617 mojom::ShellTestConfiguration::New(); 637 mojom::ShellTestConfiguration::New();
618 params->allow_external_pages = false; 638 params->allow_external_pages = false;
619 params->current_working_directory = current_working_directory_; 639 params->current_working_directory = current_working_directory_;
620 params->temp_path = temp_path_; 640 params->temp_path = temp_path_;
641 params->build_directory = GetBuildDirectory();
621 params->test_url = test_url_; 642 params->test_url = test_url_;
622 params->enable_pixel_dumping = enable_pixel_dumping_; 643 params->enable_pixel_dumping = enable_pixel_dumping_;
623 params->allow_external_pages = 644 params->allow_external_pages =
624 base::CommandLine::ForCurrentProcess()->HasSwitch( 645 base::CommandLine::ForCurrentProcess()->HasSwitch(
625 switches::kAllowExternalPages); 646 switches::kAllowExternalPages);
626 params->expected_pixel_hash = expected_pixel_hash_; 647 params->expected_pixel_hash = expected_pixel_hash_;
627 params->initial_size = initial_size_; 648 params->initial_size = initial_size_;
628 649
629 if (did_send_initial_test_configuration_) { 650 if (did_send_initial_test_configuration_) {
630 GetLayoutTestControlPtr(frame)->ReplicateTestConfiguration( 651 GetLayoutTestControlPtr(frame)->ReplicateTestConfiguration(
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 1006 }
986 DCHECK(layout_test_control_map_[frame].get()); 1007 DCHECK(layout_test_control_map_[frame].get());
987 return layout_test_control_map_[frame].get(); 1008 return layout_test_control_map_[frame].get();
988 } 1009 }
989 1010
990 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { 1011 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) {
991 layout_test_control_map_.erase(frame); 1012 layout_test_control_map_.erase(frame);
992 } 1013 }
993 1014
994 } // namespace content 1015 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/shell/common/layout_test.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698