| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
| 11 #include "content/public/browser/render_view_host.h" | 11 #include "content/public/browser/render_view_host.h" |
| 12 #include "content/public/common/page_transition_types.h" | |
| 13 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/base/page_transition_types.h" |
| 15 | 15 |
| 16 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
| 17 #include "ui/aura/test/aura_test_helper.h" | 17 #include "ui/aura/test/aura_test_helper.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace aura { | 20 namespace aura { |
| 21 namespace test { | 21 namespace test { |
| 22 class AuraTestHelper; | 22 class AuraTestHelper; |
| 23 } | 23 } |
| 24 } | 24 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 53 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned | 53 // Gives tests access to RenderFrameHostImpl::OnCreateChild. The returned |
| 54 // RenderFrameHost is owned by the parent RenderFrameHost. | 54 // RenderFrameHost is owned by the parent RenderFrameHost. |
| 55 virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; | 55 virtual RenderFrameHost* AppendChild(const std::string& frame_name) = 0; |
| 56 | 56 |
| 57 // Calls OnMsgNavigate on the RenderViewHost with the given information, | 57 // Calls OnMsgNavigate on the RenderViewHost with the given information, |
| 58 // including a custom PageTransition. Sets the rest of the | 58 // including a custom PageTransition. Sets the rest of the |
| 59 // parameters in the message to the "typical" values. This is a helper | 59 // parameters in the message to the "typical" values. This is a helper |
| 60 // function for simulating the most common types of loads. | 60 // function for simulating the most common types of loads. |
| 61 virtual void SendNavigateWithTransition(int page_id, | 61 virtual void SendNavigateWithTransition(int page_id, |
| 62 const GURL& url, | 62 const GURL& url, |
| 63 PageTransition transition) = 0; | 63 ui::PageTransition transition) = 0; |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 // An interface and utility for driving tests of RenderViewHost. | 66 // An interface and utility for driving tests of RenderViewHost. |
| 67 class RenderViewHostTester { | 67 class RenderViewHostTester { |
| 68 public: | 68 public: |
| 69 // Retrieves the RenderViewHostTester that drives the specified | 69 // Retrieves the RenderViewHostTester that drives the specified |
| 70 // RenderViewHost. The RenderViewHost must have been created while | 70 // RenderViewHost. The RenderViewHost must have been created while |
| 71 // RenderViewHost testing was enabled; use a | 71 // RenderViewHost testing was enabled; use a |
| 72 // RenderViewHostTestEnabler instance (see below) to do this. | 72 // RenderViewHostTestEnabler instance (see below) to do this. |
| 73 static RenderViewHostTester* For(RenderViewHost* host); | 73 static RenderViewHostTester* For(RenderViewHost* host); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 // setting the rest of the parameters in the message to the "typical" values. | 104 // setting the rest of the parameters in the message to the "typical" values. |
| 105 // This is a helper function for simulating the most common types of loads. | 105 // This is a helper function for simulating the most common types of loads. |
| 106 virtual void SendNavigate(int page_id, const GURL& url) = 0; | 106 virtual void SendNavigate(int page_id, const GURL& url) = 0; |
| 107 virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; | 107 virtual void SendFailedNavigate(int page_id, const GURL& url) = 0; |
| 108 | 108 |
| 109 // Calls OnMsgNavigate on the RenderViewHost with the given information, | 109 // Calls OnMsgNavigate on the RenderViewHost with the given information, |
| 110 // including a custom PageTransition. Sets the rest of the | 110 // including a custom PageTransition. Sets the rest of the |
| 111 // parameters in the message to the "typical" values. This is a helper | 111 // parameters in the message to the "typical" values. This is a helper |
| 112 // function for simulating the most common types of loads. | 112 // function for simulating the most common types of loads. |
| 113 virtual void SendNavigateWithTransition(int page_id, const GURL& url, | 113 virtual void SendNavigateWithTransition(int page_id, const GURL& url, |
| 114 PageTransition transition) = 0; | 114 ui::PageTransition transition) = 0; |
| 115 | 115 |
| 116 // Calls OnBeforeUnloadACK on the main RenderFrameHost with the given | 116 // Calls OnBeforeUnloadACK on the main RenderFrameHost with the given |
| 117 // parameter. | 117 // parameter. |
| 118 virtual void SendBeforeUnloadACK(bool proceed) = 0; | 118 virtual void SendBeforeUnloadACK(bool proceed) = 0; |
| 119 | 119 |
| 120 // If set, future loads will have |mime_type| set as the mime type. | 120 // If set, future loads will have |mime_type| set as the mime type. |
| 121 // If not set, the mime type will default to "text/html". | 121 // If not set, the mime type will default to "text/html". |
| 122 virtual void SetContentsMimeType(const std::string& mime_type) = 0; | 122 virtual void SetContentsMimeType(const std::string& mime_type) = 0; |
| 123 | 123 |
| 124 // Simulates the SwapOut_ACK that fires if you commit a cross-site | 124 // Simulates the SwapOut_ACK that fires if you commit a cross-site |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 243 |
| 244 int thread_bundle_options_; | 244 int thread_bundle_options_; |
| 245 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; | 245 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; |
| 246 | 246 |
| 247 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 247 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace content | 250 } // namespace content |
| 251 | 251 |
| 252 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 252 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
| OLD | NEW |