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

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

Issue 2060483003: [ios] Extracted web_test.h classes into separate files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed typo Created 4 years, 6 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/public/test/web_test_with_web_state.mm ('k') | ios/web/test/web_test.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/test/web_test.h
diff --git a/ios/web/test/web_test.h b/ios/web/test/web_test.h
index 9eb34823641fded0a3a0afc135ab414293a98606..62a6445837635385cc52df35f9d8e8ee6ef24244 100644
--- a/ios/web/test/web_test.h
+++ b/ios/web/test/web_test.h
@@ -5,107 +5,9 @@
#ifndef IOS_WEB_TEST_WEB_TEST_H_
#define IOS_WEB_TEST_WEB_TEST_H_
-#import <UIKit/UIKit.h>
+// TODO(crbug.com/619076): Remove this file once downsteam clients stop using it
-#import "base/ios/block_types.h"
-#import "base/ios/weak_nsobject.h"
-#import "base/mac/scoped_nsobject.h"
-#include "base/message_loop/message_loop.h"
-#include "ios/web/public/test/scoped_testing_web_client.h"
-#include "ios/web/public/test/test_browser_state.h"
-#import "ios/web/public/test/test_web_client.h"
-#include "ios/web/public/test/test_web_thread_bundle.h"
-#include "ios/web/public/web_client.h"
-#import "ios/web/web_state/ui/crw_web_controller.h"
-#include "testing/platform_test.h"
-
-namespace web {
-
-// A test fixture for web tests that need a minimum environment set up that
-// mimics a web embedder.
-class WebTest : public PlatformTest {
- protected:
- WebTest();
- ~WebTest() override;
-
- // PlatformTest methods.
- void SetUp() override;
- void TearDown() override;
-
- // Returns the WebClient that is used for testing.
- TestWebClient* GetWebClient();
-
- // Returns the BrowserState that is used for testing.
- virtual BrowserState* GetBrowserState();
-
- private:
- // The WebClient used in tests.
- ScopedTestingWebClient web_client_;
- // The threads used for testing.
- web::TestWebThreadBundle thread_bundle_;
- // The browser state used in tests.
- TestBrowserState browser_state_;
-};
-
-#pragma mark -
-
-// An abstract test fixture that sets up a WebControllers that can be loaded
-// with test HTML and JavaScripts.
-class WebTestWithWebController : public WebTest,
- public base::MessageLoop::TaskObserver {
- public:
- ~WebTestWithWebController() override;
-
- protected:
- WebTestWithWebController();
- void SetUp() override;
- void TearDown() override;
- // Loads the specified HTML content into the WebController via public APIs.
- void LoadHtml(NSString* html);
- // Loads the specified HTML content into the WebController via public APIs.
- void LoadHtml(const std::string& html);
- // Loads |url| into the WebController via public APIs.
- // Note if anyone uses this to load web pages from the live internet, the
- // tests can be flaky / dependent on content and behavior beyond our control.
- // Use this only when it's impossible to test with static HTML using LoadHtml.
- void LoadURL(const GURL& url);
- // Blocks until both known NSRunLoop-based and known message-loop-based
- // background tasks have completed
- void WaitForBackgroundTasks();
- // Blocks until known NSRunLoop-based have completed, known message-loop-based
- // background tasks have completed and |condition| evaluates to true.
- void WaitForCondition(ConditionBlock condition);
- // Evaluates JavaScript and returns result as a string.
- // DEPRECATED. TODO(crbug.com/595761): Remove this API.
- NSString* EvaluateJavaScriptAsString(NSString* script);
- // Synchronously executes JavaScript and returns result as id.
- id ExecuteJavaScript(NSString* script);
- // TaskObserver methods (used when waiting for background tasks).
- void WillProcessTask(const base::PendingTask& pending_task) override;
- void DidProcessTask(const base::PendingTask& pending_task) override;
-
- // Returns web state for this web controller.
- web::WebState* web_state();
- const web::WebState* web_state() const;
-
- // The web controller for testing.
- base::WeakNSObject<CRWWebController> webController_;
- // true if a task has been processed.
- bool processed_a_task_;
-
- private:
- // LoadURL() for data URLs sometimes lock up navigation, so if the loaded page
- // is not the one expected, reset the web view. In some cases, document or
- // document.body does not exist either; also reset in those cases.
- // Returns true if a reset occurred. One may want to load the page again.
- bool ResetPageIfNavigationStalled(NSString* load_check);
- // Creates a unique HTML element to look for in
- // ResetPageIfNavigationStalled().
- NSString* CreateLoadCheck();
- // The web state for testing.
- std::unique_ptr<WebStateImpl> web_state_impl_;
-};
-
-} // namespace web
+#import "ios/web/public/test/web_test_with_web_state.h"
+#import "ios/web/test/web_test_with_web_controller.h"
#endif // IOS_WEB_TEST_WEB_TEST_H_
« no previous file with comments | « ios/web/public/test/web_test_with_web_state.mm ('k') | ios/web/test/web_test.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698