| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "web/tests/sim/SimWebViewClient.h" | 5 #include "web/tests/sim/SimWebViewClient.h" |
| 6 | 6 |
| 7 #include "public/platform/WebLayerTreeView.h" | 7 #include "public/platform/WebLayerTreeView.h" |
| 8 #include "public/web/WebLocalFrame.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 SimWebViewClient::SimWebViewClient(WebLayerTreeView& layer_tree_view) | 12 SimWebViewClient::SimWebViewClient(WebLayerTreeView& layer_tree_view) |
| 12 : visually_non_empty_layout_count_(0), | 13 : visually_non_empty_layout_count_(0), |
| 13 finished_parsing_layout_count_(0), | 14 finished_parsing_layout_count_(0), |
| 14 finished_loading_layout_count_(0), | 15 finished_loading_layout_count_(0), |
| 15 layer_tree_view_(&layer_tree_view) {} | 16 layer_tree_view_(&layer_tree_view) {} |
| 16 | 17 |
| 17 void SimWebViewClient::DidMeaningfulLayout( | 18 void SimWebViewClient::DidMeaningfulLayout( |
| 18 WebMeaningfulLayout meaningful_layout) { | 19 WebMeaningfulLayout meaningful_layout) { |
| 19 switch (meaningful_layout) { | 20 switch (meaningful_layout) { |
| 20 case WebMeaningfulLayout::kVisuallyNonEmpty: | 21 case WebMeaningfulLayout::kVisuallyNonEmpty: |
| 21 visually_non_empty_layout_count_++; | 22 visually_non_empty_layout_count_++; |
| 22 break; | 23 break; |
| 23 case WebMeaningfulLayout::kFinishedParsing: | 24 case WebMeaningfulLayout::kFinishedParsing: |
| 24 finished_parsing_layout_count_++; | 25 finished_parsing_layout_count_++; |
| 25 break; | 26 break; |
| 26 case WebMeaningfulLayout::kFinishedLoading: | 27 case WebMeaningfulLayout::kFinishedLoading: |
| 27 finished_loading_layout_count_++; | 28 finished_loading_layout_count_++; |
| 28 break; | 29 break; |
| 29 } | 30 } |
| 30 } | 31 } |
| 31 | 32 |
| 33 WebView* SimWebViewClient::CreateView(WebLocalFrame* opener, |
| 34 const WebURLRequest&, |
| 35 const WebWindowFeatures&, |
| 36 const WebString& name, |
| 37 WebNavigationPolicy, |
| 38 bool) { |
| 39 return web_view_helper_.InitializeWithOpener(opener, true); |
| 40 } |
| 41 |
| 32 } // namespace blink | 42 } // namespace blink |
| OLD | NEW |