| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 ShellContentBrowserClient::Get()->browser_context(); | 714 ShellContentBrowserClient::Get()->browser_context(); |
| 715 StoragePartition* storage_partition = | 715 StoragePartition* storage_partition = |
| 716 BrowserContext::GetStoragePartition(browser_context, nullptr); | 716 BrowserContext::GetStoragePartition(browser_context, nullptr); |
| 717 storage_partition->GetServiceWorkerContext()->ClearAllServiceWorkersForTest( | 717 storage_partition->GetServiceWorkerContext()->ClearAllServiceWorkersForTest( |
| 718 base::Bind(&BlinkTestController::OnAllServiceWorkersCleared, | 718 base::Bind(&BlinkTestController::OnAllServiceWorkersCleared, |
| 719 base::Unretained(this))); | 719 base::Unretained(this))); |
| 720 storage_partition->ClearBluetoothAllowedDevicesMapForTesting(); | 720 storage_partition->ClearBluetoothAllowedDevicesMapForTesting(); |
| 721 } | 721 } |
| 722 | 722 |
| 723 void BlinkTestController::OnAllServiceWorkersCleared() { | 723 void BlinkTestController::OnAllServiceWorkersCleared() { |
| 724 Send(new ShellViewMsg_Reset( | 724 if (main_window_) { |
| 725 main_window_->web_contents()->GetRenderViewHost()->GetRoutingID())); | 725 Send(new ShellViewMsg_Reset( |
| 726 main_window_->web_contents()->GetRenderViewHost()->GetRoutingID())); |
| 727 } |
| 726 } | 728 } |
| 727 | 729 |
| 728 void BlinkTestController::OnImageDump(const std::string& actual_pixel_hash, | 730 void BlinkTestController::OnImageDump(const std::string& actual_pixel_hash, |
| 729 const SkBitmap& image) { | 731 const SkBitmap& image) { |
| 730 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); | 732 printer_->PrintImageHeader(actual_pixel_hash, expected_pixel_hash_); |
| 731 | 733 |
| 732 // Only encode and dump the png if the hashes don't match. Encoding the | 734 // Only encode and dump the png if the hashes don't match. Encoding the |
| 733 // image is really expensive. | 735 // image is really expensive. |
| 734 if (actual_pixel_hash != expected_pixel_hash_) { | 736 if (actual_pixel_hash != expected_pixel_hash_) { |
| 735 std::vector<unsigned char> png; | 737 std::vector<unsigned char> png; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 } | 1041 } |
| 1040 DCHECK(layout_test_control_map_[frame].get()); | 1042 DCHECK(layout_test_control_map_[frame].get()); |
| 1041 return layout_test_control_map_[frame].get(); | 1043 return layout_test_control_map_[frame].get(); |
| 1042 } | 1044 } |
| 1043 | 1045 |
| 1044 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { | 1046 void BlinkTestController::HandleLayoutTestControlError(RenderFrameHost* frame) { |
| 1045 layout_test_control_map_.erase(frame); | 1047 layout_test_control_map_.erase(frame); |
| 1046 } | 1048 } |
| 1047 | 1049 |
| 1048 } // namespace content | 1050 } // namespace content |
| OLD | NEW |