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

Unified Diff: ios/web/public/test/web_test_with_web_state.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.mm ('k') | ios/web/public/test/web_test_with_web_state.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/web_test_with_web_state.h
diff --git a/ios/web/test/web_test.h b/ios/web/public/test/web_test_with_web_state.h
similarity index 58%
copy from ios/web/test/web_test.h
copy to ios/web/public/test/web_test_with_web_state.h
index 9eb34823641fded0a3a0afc135ab414293a98606..527a0e4236e3fe5e08f5435336702abddc0d3b87 100644
--- a/ios/web/test/web_test.h
+++ b/ios/web/public/test/web_test_with_web_state.h
@@ -1,65 +1,37 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef IOS_WEB_TEST_WEB_TEST_H_
-#define IOS_WEB_TEST_WEB_TEST_H_
+#ifndef IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_
+#define IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_
-#import <UIKit/UIKit.h>
-
-#import "base/ios/block_types.h"
+#include "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"
+#include "ios/web/public/test/web_test.h"
+#include "url/gurl.h"
+
+@class CRWWebController;
namespace web {
-// A test fixture for web tests that need a minimum environment set up that
-// mimics a web embedder.
-class WebTest : public PlatformTest {
+class WebState;
+
+// Base test fixture that provides WebState for testing.
+class WebTestWithWebState : public WebTest,
+ public base::MessageLoop::TaskObserver {
protected:
- WebTest();
- ~WebTest() override;
+ WebTestWithWebState();
+ ~WebTestWithWebState() override;
- // PlatformTest methods.
+ // WebTest overrides.
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;
+ // base::MessageLoop::TaskObserver overrides.
+ void WillProcessTask(const base::PendingTask& pending_task) override;
+ void DidProcessTask(const base::PendingTask& pending_task) 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.
@@ -80,15 +52,13 @@ class WebTestWithWebController : public WebTest,
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.
+ // TODO(crbug.com/619076): Remove this ivar.
base::WeakNSObject<CRWWebController> webController_;
// true if a task has been processed.
bool processed_a_task_;
@@ -103,9 +73,9 @@ class WebTestWithWebController : public WebTest,
// ResetPageIfNavigationStalled().
NSString* CreateLoadCheck();
// The web state for testing.
- std::unique_ptr<WebStateImpl> web_state_impl_;
+ std::unique_ptr<WebState> web_state_;
};
} // namespace web
-#endif // IOS_WEB_TEST_WEB_TEST_H_
+#endif // IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_
« no previous file with comments | « ios/web/public/test/web_test.mm ('k') | ios/web/public/test/web_test_with_web_state.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698