| 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 #import "ios/web/test/web_int_test.h" | 5 #import "ios/web/test/web_int_test.h" |
| 6 | 6 |
| 7 #import "base/ios/block_types.h" | 7 #import "base/ios/block_types.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #import "ios/web/public/test/http_server.h" | 10 #import "ios/web/public/test/http_server.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 DCHECK(block); | 95 DCHECK(block); |
| 96 observer_ = base::MakeUnique<IntTestWebStateObserver>(web_state()); | 96 observer_ = base::MakeUnique<IntTestWebStateObserver>(web_state()); |
| 97 observer_->ExpectPageLoad(url); | 97 observer_->ExpectPageLoad(url); |
| 98 block(); | 98 block(); |
| 99 base::test::ios::WaitUntilCondition(^bool { | 99 base::test::ios::WaitUntilCondition(^bool { |
| 100 return observer_->IsExpectedPageLoaded(); | 100 return observer_->IsExpectedPageLoaded(); |
| 101 }); | 101 }); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void WebIntTest::LoadUrl(const GURL& url) { | 104 void WebIntTest::LoadUrl(const GURL& url) { |
| 105 ExecuteBlockAndWaitForLoad(url, ^{ | 105 web::NavigationManager::WebLoadParams params(url); |
| 106 web::NavigationManager::WebLoadParams params(url); | 106 params.transition_type = ui::PageTransition::PAGE_TRANSITION_TYPED; |
| 107 params.transition_type = ui::PageTransition::PAGE_TRANSITION_TYPED; | 107 LoadWithParams(params); |
| 108 navigation_manager()->LoadURLWithParams(params); | 108 } |
| 109 |
| 110 void WebIntTest::LoadWithParams( |
| 111 const NavigationManager::WebLoadParams& params) { |
| 112 NavigationManager::WebLoadParams block_params(params); |
| 113 ExecuteBlockAndWaitForLoad(params.url, ^{ |
| 114 navigation_manager()->LoadURLWithParams(block_params); |
| 109 }); | 115 }); |
| 110 } | 116 } |
| 111 | 117 |
| 112 void WebIntTest::RemoveWKWebViewCreatedData(WKWebsiteDataStore* data_store, | 118 void WebIntTest::RemoveWKWebViewCreatedData(WKWebsiteDataStore* data_store, |
| 113 NSSet* websiteDataTypes) { | 119 NSSet* websiteDataTypes) { |
| 114 __block bool data_removed = false; | 120 __block bool data_removed = false; |
| 115 | 121 |
| 116 ProceduralBlock remove_data = ^{ | 122 ProceduralBlock remove_data = ^{ |
| 117 [data_store removeDataOfTypes:websiteDataTypes | 123 [data_store removeDataOfTypes:websiteDataTypes |
| 118 modifiedSince:[NSDate distantPast] | 124 modifiedSince:[NSDate distantPast] |
| (...skipping 27 matching lines...) Expand all Loading... |
| 146 NSInteger WebIntTest::GetIndexOfNavigationItem( | 152 NSInteger WebIntTest::GetIndexOfNavigationItem( |
| 147 const web::NavigationItem* item) { | 153 const web::NavigationItem* item) { |
| 148 for (NSInteger i = 0; i < navigation_manager()->GetItemCount(); ++i) { | 154 for (NSInteger i = 0; i < navigation_manager()->GetItemCount(); ++i) { |
| 149 if (navigation_manager()->GetItemAtIndex(i) == item) | 155 if (navigation_manager()->GetItemAtIndex(i) == item) |
| 150 return i; | 156 return i; |
| 151 } | 157 } |
| 152 return NSNotFound; | 158 return NSNotFound; |
| 153 } | 159 } |
| 154 | 160 |
| 155 } // namespace web | 161 } // namespace web |
| OLD | NEW |