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

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

Issue 2513423003: DevTools: Convert inspector-unit tests to use reusable test harness (Closed)
Patch Set: Moved type definition out of externs Created 4 years 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 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>
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bool BlinkTestController::PrepareForLayoutTest( 261 bool BlinkTestController::PrepareForLayoutTest(
262 const GURL& test_url, 262 const GURL& test_url,
263 const base::FilePath& current_working_directory, 263 const base::FilePath& current_working_directory,
264 bool enable_pixel_dumping, 264 bool enable_pixel_dumping,
265 const std::string& expected_pixel_hash) { 265 const std::string& expected_pixel_hash) {
266 DCHECK(CalledOnValidThread()); 266 DCHECK(CalledOnValidThread());
267 test_phase_ = DURING_TEST; 267 test_phase_ = DURING_TEST;
268 current_working_directory_ = current_working_directory; 268 current_working_directory_ = current_working_directory;
269 enable_pixel_dumping_ = enable_pixel_dumping; 269 enable_pixel_dumping_ = enable_pixel_dumping;
270 expected_pixel_hash_ = expected_pixel_hash; 270 expected_pixel_hash_ = expected_pixel_hash;
271 test_url_ = test_url; 271 if (test_url.spec().find("/inspector-unit/") == std::string::npos)
272 test_url_ = test_url;
273 else
274 test_url_ = LayoutTestDevToolsFrontend::MapJSTestURL(test_url);
272 did_send_initial_test_configuration_ = false; 275 did_send_initial_test_configuration_ = false;
273 printer_->reset(); 276 printer_->reset();
274 frame_to_layout_dump_map_.clear(); 277 frame_to_layout_dump_map_.clear();
275 render_process_host_observer_.RemoveAll(); 278 render_process_host_observer_.RemoveAll();
276 all_observed_render_process_hosts_.clear(); 279 all_observed_render_process_hosts_.clear();
277 main_window_render_process_hosts_.clear(); 280 main_window_render_process_hosts_.clear();
278 accumulated_layout_test_runtime_flags_changes_.Clear(); 281 accumulated_layout_test_runtime_flags_changes_.Clear();
279 ShellBrowserContext* browser_context = 282 ShellBrowserContext* browser_context =
280 ShellContentBrowserClient::Get()->browser_context(); 283 ShellContentBrowserClient::Get()->browser_context();
281 is_compositing_test_ = 284 is_compositing_test_ =
282 test_url.spec().find("compositing/") != std::string::npos; 285 test_url_.spec().find("compositing/") != std::string::npos;
283 initial_size_ = Shell::GetShellDefaultSize(); 286 initial_size_ = Shell::GetShellDefaultSize();
284 // The W3C SVG layout tests use a different size than the other layout tests. 287 // The W3C SVG layout tests use a different size than the other layout tests.
285 if (test_url.spec().find("W3C-SVG-1.1") != std::string::npos) 288 if (test_url_.spec().find("W3C-SVG-1.1") != std::string::npos)
286 initial_size_ = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip); 289 initial_size_ = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip);
287 if (!main_window_) { 290 if (!main_window_) {
288 main_window_ = content::Shell::CreateNewWindow( 291 main_window_ = content::Shell::CreateNewWindow(
289 browser_context, 292 browser_context,
290 GURL(), 293 GURL(),
291 NULL, 294 NULL,
292 initial_size_); 295 initial_size_);
293 WebContentsObserver::Observe(main_window_->web_contents()); 296 WebContentsObserver::Observe(main_window_->web_contents());
294 current_pid_ = base::kNullProcessId; 297 current_pid_ = base::kNullProcessId;
295 default_prefs_ = 298 default_prefs_ =
296 main_window_->web_contents()->GetRenderViewHost()->GetWebkitPreferences(); 299 main_window_->web_contents()->GetRenderViewHost()->GetWebkitPreferences();
297 main_window_->LoadURL(test_url); 300 main_window_->LoadURL(test_url_);
298 } else { 301 } else {
299 #if defined(OS_MACOSX) 302 #if defined(OS_MACOSX)
300 // Shell::SizeTo is not implemented on all platforms. 303 // Shell::SizeTo is not implemented on all platforms.
301 main_window_->SizeTo(initial_size_); 304 main_window_->SizeTo(initial_size_);
302 #endif 305 #endif
303 main_window_->web_contents() 306 main_window_->web_contents()
304 ->GetRenderViewHost() 307 ->GetRenderViewHost()
305 ->GetWidget() 308 ->GetWidget()
306 ->GetView() 309 ->GetView()
307 ->SetSize(initial_size_); 310 ->SetSize(initial_size_);
308 main_window_->web_contents() 311 main_window_->web_contents()
309 ->GetRenderViewHost() 312 ->GetRenderViewHost()
310 ->GetWidget() 313 ->GetWidget()
311 ->WasResized(); 314 ->WasResized();
312 RenderViewHost* render_view_host = 315 RenderViewHost* render_view_host =
313 main_window_->web_contents()->GetRenderViewHost(); 316 main_window_->web_contents()->GetRenderViewHost();
314 317
315 // Compositing tests override the default preferences (see 318 // Compositing tests override the default preferences (see
316 // BlinkTestController::OverrideWebkitPrefs) so we force them to be 319 // BlinkTestController::OverrideWebkitPrefs) so we force them to be
317 // calculated again to ensure is_compositing_test_ changes are picked up. 320 // calculated again to ensure is_compositing_test_ changes are picked up.
318 OverrideWebkitPrefs(&default_prefs_); 321 OverrideWebkitPrefs(&default_prefs_);
319 322
320 render_view_host->UpdateWebkitPreferences(default_prefs_); 323 render_view_host->UpdateWebkitPreferences(default_prefs_);
321 HandleNewRenderFrameHost(render_view_host->GetMainFrame()); 324 HandleNewRenderFrameHost(render_view_host->GetMainFrame());
322 325
323 NavigationController::LoadURLParams params(test_url); 326 NavigationController::LoadURLParams params(test_url_);
324 params.transition_type = ui::PageTransitionFromInt( 327 params.transition_type = ui::PageTransitionFromInt(
325 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); 328 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
326 params.should_clear_history_list = true; 329 params.should_clear_history_list = true;
327 main_window_->web_contents()->GetController().LoadURLWithParams(params); 330 main_window_->web_contents()->GetController().LoadURLWithParams(params);
328 main_window_->web_contents()->Focus(); 331 main_window_->web_contents()->Focus();
329 } 332 }
330 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->SetActive( 333 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->SetActive(
331 true); 334 true);
332 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); 335 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus();
333 return true; 336 return true;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 } else { 947 } else {
945 printer_->AddErrorMessage(base::StringPrintf( 948 printer_->AddErrorMessage(base::StringPrintf(
946 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", 949 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.",
947 event_name.c_str())); 950 event_name.c_str()));
948 return; 951 return;
949 } 952 }
950 bluetooth_chooser_factory_->SendEvent(event, argument); 953 bluetooth_chooser_factory_->SendEvent(event, argument);
951 } 954 }
952 955
953 } // namespace content 956 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698