Chromium Code Reviews| 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 674 | 674 |
| 675 process->Send(new LayoutTestMsg_ReplicateLayoutTestRuntimeFlagsChanges( | 675 process->Send(new LayoutTestMsg_ReplicateLayoutTestRuntimeFlagsChanges( |
| 676 accumulated_layout_test_runtime_flags_changes_)); | 676 accumulated_layout_test_runtime_flags_changes_)); |
| 677 } | 677 } |
| 678 } | 678 } |
| 679 | 679 |
| 680 void BlinkTestController::OnTestFinished() { | 680 void BlinkTestController::OnTestFinished() { |
| 681 test_phase_ = CLEAN_UP; | 681 test_phase_ = CLEAN_UP; |
| 682 if (!printer_->output_finished()) | 682 if (!printer_->output_finished()) |
| 683 printer_->PrintImageFooter(); | 683 printer_->PrintImageFooter(); |
| 684 RenderViewHost* render_view_host = | |
| 685 main_window_->web_contents()->GetRenderViewHost(); | |
| 686 main_window_->web_contents()->ExitFullscreen(/*will_cause_resize=*/false); | 684 main_window_->web_contents()->ExitFullscreen(/*will_cause_resize=*/false); |
| 687 | 685 |
| 688 ShellBrowserContext* browser_context = | 686 ShellBrowserContext* browser_context = |
| 689 ShellContentBrowserClient::Get()->browser_context(); | 687 ShellContentBrowserClient::Get()->browser_context(); |
| 690 StoragePartition* storage_partition = | 688 StoragePartition* storage_partition = |
| 691 BrowserContext::GetStoragePartition(browser_context, nullptr); | 689 BrowserContext::GetStoragePartition(browser_context, nullptr); |
| 692 storage_partition->GetServiceWorkerContext()->ClearAllServiceWorkersForTest( | 690 storage_partition->GetServiceWorkerContext()->ClearAllServiceWorkersForTest( |
| 693 base::Bind(base::IgnoreResult(&BlinkTestController::Send), | 691 base::Bind(&BlinkTestController::OnAllServiceWorkersCleared, |
| 694 base::Unretained(this), | 692 base::Unretained(this))); |
| 695 new ShellViewMsg_Reset(render_view_host->GetRoutingID()))); | |
| 696 storage_partition->ClearBluetoothAllowedDevicesMapForTesting(); | 693 storage_partition->ClearBluetoothAllowedDevicesMapForTesting(); |
| 697 } | 694 } |
| 698 | 695 |
| 696 void BlinkTestController::OnAllServiceWorkersCleared() { | |
| 697 Send(new ShellViewMsg_Reset( | |
| 698 main_window_->web_contents()->GetRenderViewHost()->GetRoutingID())); | |
|
Łukasz Anforowicz
2017/06/22 16:45:45
It turns out that |main_window_| can be null here
| |
| 699 } | |
| 700 | |
| 699 void BlinkTestController::OnImageDump(const std::string& actual_pixel_hash, | 701 void BlinkTestController::OnImageDump(const std::string& actual_pixel_hash, |
| 700 const SkBitmap& image) { | 702 const SkBitmap& image) { |
| 701 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); | 703 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); |
| 702 | 704 |
| 703 // Only encode and dump the png if the hashes don't match. Encoding the | 705 // Only encode and dump the png if the hashes don't match. Encoding the |
| 704 // image is really expensive. | 706 // image is really expensive. |
| 705 if (actual_pixel_hash != expected_pixel_hash_) { | 707 if (actual_pixel_hash != expected_pixel_hash_) { |
| 706 std::vector<unsigned char> png; | 708 std::vector<unsigned char> png; |
| 707 | 709 |
| 708 bool discard_transparency = true; | 710 bool discard_transparency = true; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1016 } | 1018 } |
| 1017 DCHECK(layout_test_control_map_[frame].get()); | 1019 DCHECK(layout_test_control_map_[frame].get()); |
| 1018 return layout_test_control_map_[frame].get(); | 1020 return layout_test_control_map_[frame].get(); |
| 1019 } | 1021 } |
| 1020 | 1022 |
| 1021 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { | 1023 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { |
| 1022 layout_test_control_map_.erase(frame); | 1024 layout_test_control_map_.erase(frame); |
| 1023 } | 1025 } |
| 1024 | 1026 |
| 1025 } // namespace content | 1027 } // namespace content |
| OLD | NEW |