Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(889)

Unified Diff: ios/web/test/web_int_test.h

Issue 2599233002: Created test for window.location.assign. (Closed)
Patch Set: move shared code to WebIntTest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/navigation/window_location_inttest.mm ('k') | ios/web/test/web_int_test.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/test/web_int_test.h
diff --git a/ios/web/test/web_int_test.h b/ios/web/test/web_int_test.h
index e2c10288804f99e003ea04496f05fa39b3a1a15d..8544c257460a6fe164c4216b191e310615f7ac33 100644
--- a/ios/web/test/web_int_test.h
+++ b/ios/web/test/web_int_test.h
@@ -7,10 +7,17 @@
#import <WebKit/WebKit.h>
+#import "base/ios/block_types.h"
+#import "ios/web/public/navigation_manager.h"
#include "ios/web/public/test/web_test.h"
+#import "ios/web/public/web_state/web_state.h"
+
+class GURL;
namespace web {
+class IntTestWebStateObserver;
+
// A test fixture for integration tests that need to bring up the HttpServer.
class WebIntTest : public WebTest {
protected:
@@ -21,12 +28,38 @@ class WebIntTest : public WebTest {
void SetUp() override;
void TearDown() override;
+ // The WebState and NavigationManager used by this test fixture.
+ WebState* web_state() { return web_state_.get(); }
+ NavigationManager* navigation_manager() {
+ return web_state()->GetNavigationManager();
+ }
+
+ // Synchronously executes |script| on |web_state|'s JS injection receiver and
+ // returns the result.
+ id ExecuteJavaScript(NSString* script);
+
+ // Executes |block| and waits until |url| is successfully loaded in
+ // |web_state_|.
+ void ExecuteBlockAndWaitForLoad(const GURL& url, ProceduralBlock block);
+
+ // Navigates |web_state_| to |url| and waits for the page to be loaded.
+ void LoadUrl(const GURL& url);
+
// Synchronously removes data from |data_store|.
// |websiteDataTypes| is from the constants defined in
// "WebKit/WKWebsiteDataRecord".
void RemoveWKWebViewCreatedData(WKWebsiteDataStore* data_store,
NSSet* websiteDataTypes);
+ // Returns the index of |item| in the |navigation_manager|'s session history,
+ // or NSNotFound if it is not present.
+ NSInteger GetIndexOfNavigationItem(const web::NavigationItem* item);
+
+ private:
+ // WebState used to load pages.
+ std::unique_ptr<WebState> web_state_;
+ // WebStateObserver used to wait for page loads.
+ std::unique_ptr<IntTestWebStateObserver> observer_;
};
} // namespace web
« no previous file with comments | « ios/web/navigation/window_location_inttest.mm ('k') | ios/web/test/web_int_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698