Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 6 #define IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| 7 | 7 |
| 8 #import "base/ios/block_types.h" | 8 #import "base/ios/block_types.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ios/web/public/test/web_test.h" | 10 #include "ios/web/public/test/web_test.h" |
| 11 #include "ui/base/page_transition_types.h" | |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 | 13 |
| 13 namespace web { | 14 namespace web { |
| 14 | 15 |
| 15 class WebState; | 16 class WebState; |
| 16 | 17 |
| 17 // Base test fixture that provides WebState for testing. | 18 // Base test fixture that provides WebState for testing. |
| 18 class WebTestWithWebState : public WebTest, | 19 class WebTestWithWebState : public WebTest, |
| 19 public base::MessageLoop::TaskObserver { | 20 public base::MessageLoop::TaskObserver { |
| 20 protected: | 21 protected: |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 42 // Destroys underlying WebState. web_state() will return null after this call. | 43 // Destroys underlying WebState. web_state() will return null after this call. |
| 43 void DestroyWebState(); | 44 void DestroyWebState(); |
| 44 | 45 |
| 45 // Returns the base URL of the loaded page. | 46 // Returns the base URL of the loaded page. |
| 46 std::string BaseUrl() const; | 47 std::string BaseUrl() const; |
| 47 | 48 |
| 48 // Returns web state for this web controller. | 49 // Returns web state for this web controller. |
| 49 web::WebState* web_state(); | 50 web::WebState* web_state(); |
| 50 const web::WebState* web_state() const; | 51 const web::WebState* web_state() const; |
| 51 | 52 |
| 53 // Adds a pending item to the NavigationManager associated with the WebState. | |
| 54 void AddPendingItem(const GURL& url, ui::PageTransition transition); | |
|
Eugene But (OOO till 7-30)
2017/04/04 18:22:31
Could you please move this closer to LoadHtml. The
liaoyuke
2017/04/04 21:15:40
Done.
| |
| 55 | |
| 52 private: | 56 private: |
| 53 // base::MessageLoop::TaskObserver overrides. | 57 // base::MessageLoop::TaskObserver overrides. |
| 54 void WillProcessTask(const base::PendingTask& pending_task) override; | 58 void WillProcessTask(const base::PendingTask& pending_task) override; |
| 55 void DidProcessTask(const base::PendingTask& pending_task) override; | 59 void DidProcessTask(const base::PendingTask& pending_task) override; |
| 56 | 60 |
| 57 // The web state for testing. | 61 // The web state for testing. |
| 58 std::unique_ptr<WebState> web_state_; | 62 std::unique_ptr<WebState> web_state_; |
| 59 // true if a task has been processed. | 63 // true if a task has been processed. |
| 60 bool processed_a_task_; | 64 bool processed_a_task_; |
| 61 }; | 65 }; |
| 62 | 66 |
| 63 } // namespace web | 67 } // namespace web |
| 64 | 68 |
| 65 #endif // IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ | 69 #endif // IOS_WEB_PUBLIC_TEST_WEB_TEST_WITH_WEB_STATE_H_ |
| OLD | NEW |