OLD | NEW |
---|---|
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 215 |
216 // static | 216 // static |
217 BlinkTestController* BlinkTestController::Get() { | 217 BlinkTestController* BlinkTestController::Get() { |
218 DCHECK(instance_); | 218 DCHECK(instance_); |
219 return instance_; | 219 return instance_; |
220 } | 220 } |
221 | 221 |
222 BlinkTestController::BlinkTestController() | 222 BlinkTestController::BlinkTestController() |
223 : main_window_(NULL), | 223 : main_window_(NULL), |
224 test_phase_(BETWEEN_TESTS), | 224 test_phase_(BETWEEN_TESTS), |
225 is_compositing_test_(false), | |
225 is_leak_detection_enabled_( | 226 is_leak_detection_enabled_( |
226 base::CommandLine::ForCurrentProcess()->HasSwitch( | 227 base::CommandLine::ForCurrentProcess()->HasSwitch( |
227 switches::kEnableLeakDetection)), | 228 switches::kEnableLeakDetection)), |
228 crash_when_leak_found_(false), | 229 crash_when_leak_found_(false), |
229 devtools_frontend_(NULL), | 230 devtools_frontend_(NULL), |
230 render_process_host_observer_(this) { | 231 render_process_host_observer_(this) { |
231 CHECK(!instance_); | 232 CHECK(!instance_); |
232 instance_ = this; | 233 instance_ = this; |
233 | 234 |
234 if (is_leak_detection_enabled_) { | 235 if (is_leak_detection_enabled_) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 ->GetRenderViewHost() | 305 ->GetRenderViewHost() |
305 ->GetWidget() | 306 ->GetWidget() |
306 ->GetView() | 307 ->GetView() |
307 ->SetSize(initial_size_); | 308 ->SetSize(initial_size_); |
308 main_window_->web_contents() | 309 main_window_->web_contents() |
309 ->GetRenderViewHost() | 310 ->GetRenderViewHost() |
310 ->GetWidget() | 311 ->GetWidget() |
311 ->WasResized(); | 312 ->WasResized(); |
312 RenderViewHost* render_view_host = | 313 RenderViewHost* render_view_host = |
313 main_window_->web_contents()->GetRenderViewHost(); | 314 main_window_->web_contents()->GetRenderViewHost(); |
315 if (is_compositing_test_) { | |
Xianzhu
2016/08/04 15:53:26
Can we just omit this condition, to ensure the pre
pdr.
2016/08/08 21:29:40
Good idea. I thought that might be too slow but fo
| |
316 // Force the existing host to recompute default preferences and pickup | |
317 // compositing preference overrides. | |
318 render_view_host->OnWebkitPreferencesChanged(); | |
319 default_prefs_ = render_view_host->GetWebkitPreferences(); | |
320 } | |
314 render_view_host->UpdateWebkitPreferences(default_prefs_); | 321 render_view_host->UpdateWebkitPreferences(default_prefs_); |
Xianzhu
2016/08/04 16:04:52
Would it work to just change the above call to the
| |
315 HandleNewRenderFrameHost(render_view_host->GetMainFrame()); | 322 HandleNewRenderFrameHost(render_view_host->GetMainFrame()); |
316 | 323 |
317 NavigationController::LoadURLParams params(test_url); | 324 NavigationController::LoadURLParams params(test_url); |
318 params.transition_type = ui::PageTransitionFromInt( | 325 params.transition_type = ui::PageTransitionFromInt( |
319 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); | 326 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); |
320 params.should_clear_history_list = true; | 327 params.should_clear_history_list = true; |
321 main_window_->web_contents()->GetController().LoadURLWithParams(params); | 328 main_window_->web_contents()->GetController().LoadURLWithParams(params); |
322 main_window_->web_contents()->Focus(); | 329 main_window_->web_contents()->Focus(); |
323 } | 330 } |
324 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->SetActive( | 331 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->SetActive( |
325 true); | 332 true); |
326 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); | 333 main_window_->web_contents()->GetRenderViewHost()->GetWidget()->Focus(); |
327 return true; | 334 return true; |
328 } | 335 } |
329 | 336 |
330 bool BlinkTestController::ResetAfterLayoutTest() { | 337 bool BlinkTestController::ResetAfterLayoutTest() { |
331 DCHECK(CalledOnValidThread()); | 338 DCHECK(CalledOnValidThread()); |
332 printer_->PrintTextFooter(); | 339 printer_->PrintTextFooter(); |
333 printer_->PrintImageFooter(); | 340 printer_->PrintImageFooter(); |
334 printer_->CloseStderr(); | 341 printer_->CloseStderr(); |
335 did_send_initial_test_configuration_ = false; | 342 did_send_initial_test_configuration_ = false; |
336 test_phase_ = BETWEEN_TESTS; | 343 test_phase_ = BETWEEN_TESTS; |
337 is_compositing_test_ = false; | 344 if (is_compositing_test_) { |
345 // Compositing tests change preferences so explicitly reset them. | |
346 ApplyLayoutTestDefaultPreferences(&default_prefs_); | |
347 RenderViewHost* render_view_host = | |
348 main_window_->web_contents()->GetRenderViewHost(); | |
349 render_view_host->UpdateWebkitPreferences(default_prefs_); | |
350 is_compositing_test_ = false; | |
Xianzhu
2016/08/04 16:04:52
1. Is the above code necessary as we always update
| |
351 } | |
338 enable_pixel_dumping_ = false; | 352 enable_pixel_dumping_ = false; |
339 expected_pixel_hash_.clear(); | 353 expected_pixel_hash_.clear(); |
340 test_url_ = GURL(); | 354 test_url_ = GURL(); |
341 prefs_ = WebPreferences(); | 355 prefs_ = WebPreferences(); |
342 should_override_prefs_ = false; | 356 should_override_prefs_ = false; |
343 | 357 |
344 #if defined(OS_ANDROID) | 358 #if defined(OS_ANDROID) |
345 // Re-using the shell's main window on Android causes issues with networking | 359 // Re-using the shell's main window on Android causes issues with networking |
346 // requests never succeeding. See http://crbug.com/277652. | 360 // requests never succeeding. See http://crbug.com/277652. |
347 DiscardMainWindow(); | 361 DiscardMainWindow(); |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
937 } else { | 951 } else { |
938 printer_->AddErrorMessage(base::StringPrintf( | 952 printer_->AddErrorMessage(base::StringPrintf( |
939 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", | 953 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", |
940 event_name.c_str())); | 954 event_name.c_str())); |
941 return; | 955 return; |
942 } | 956 } |
943 bluetooth_chooser_factory_->SendEvent(event, argument); | 957 bluetooth_chooser_factory_->SendEvent(event, argument); |
944 } | 958 } |
945 | 959 |
946 } // namespace content | 960 } // namespace content |
OLD | NEW |