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 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 flags |= kModifierMap[i].dst; | 109 flags |= kModifierMap[i].dst; |
110 } | 110 } |
111 } | 111 } |
112 return flags; | 112 return flags; |
113 } | 113 } |
114 #endif | 114 #endif |
115 | 115 |
116 class WebUITestWebUIControllerFactory : public WebUIControllerFactory { | 116 class WebUITestWebUIControllerFactory : public WebUIControllerFactory { |
117 public: | 117 public: |
118 virtual WebUIController* CreateWebUIControllerForURL( | 118 virtual WebUIController* CreateWebUIControllerForURL( |
119 WebUI* web_ui, const GURL& url) const OVERRIDE { | 119 WebUI* web_ui, const GURL& url) const override { |
120 return NULL; | 120 return NULL; |
121 } | 121 } |
122 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 122 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, |
123 const GURL& url) const OVERRIDE { | 123 const GURL& url) const override { |
124 return WebUI::kNoWebUI; | 124 return WebUI::kNoWebUI; |
125 } | 125 } |
126 virtual bool UseWebUIForURL(BrowserContext* browser_context, | 126 virtual bool UseWebUIForURL(BrowserContext* browser_context, |
127 const GURL& url) const OVERRIDE { | 127 const GURL& url) const override { |
128 return HasWebUIScheme(url); | 128 return HasWebUIScheme(url); |
129 } | 129 } |
130 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, | 130 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, |
131 const GURL& url) const OVERRIDE { | 131 const GURL& url) const override { |
132 return HasWebUIScheme(url); | 132 return HasWebUIScheme(url); |
133 } | 133 } |
134 }; | 134 }; |
135 | 135 |
136 } // namespace | 136 } // namespace |
137 | 137 |
138 class RenderViewImplTest : public RenderViewTest { | 138 class RenderViewImplTest : public RenderViewTest { |
139 public: | 139 public: |
140 RenderViewImplTest() { | 140 RenderViewImplTest() { |
141 // Attach a pseudo keyboard device to this object. | 141 // Attach a pseudo keyboard device to this object. |
142 mock_keyboard_.reset(new MockKeyboard()); | 142 mock_keyboard_.reset(new MockKeyboard()); |
143 } | 143 } |
144 | 144 |
145 virtual ~RenderViewImplTest() {} | 145 virtual ~RenderViewImplTest() {} |
146 | 146 |
147 virtual void SetUp() OVERRIDE { | 147 virtual void SetUp() override { |
148 RenderViewTest::SetUp(); | 148 RenderViewTest::SetUp(); |
149 // Enable Blink's experimental and test only features so that test code | 149 // Enable Blink's experimental and test only features so that test code |
150 // does not have to bother enabling each feature. | 150 // does not have to bother enabling each feature. |
151 WebRuntimeFeatures::enableExperimentalFeatures(true); | 151 WebRuntimeFeatures::enableExperimentalFeatures(true); |
152 WebRuntimeFeatures::enableTestOnlyFeatures(true); | 152 WebRuntimeFeatures::enableTestOnlyFeatures(true); |
153 } | 153 } |
154 | 154 |
155 RenderViewImpl* view() { | 155 RenderViewImpl* view() { |
156 return static_cast<RenderViewImpl*>(view_); | 156 return static_cast<RenderViewImpl*>(view_); |
157 } | 157 } |
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 | 2162 |
2163 EXPECT_TRUE(is_input_type_called); | 2163 EXPECT_TRUE(is_input_type_called); |
2164 EXPECT_TRUE(is_selection_called); | 2164 EXPECT_TRUE(is_selection_called); |
2165 | 2165 |
2166 // InputTypeChange shold be called earlier than SelectionChanged. | 2166 // InputTypeChange shold be called earlier than SelectionChanged. |
2167 EXPECT_LT(last_input_type, last_selection); | 2167 EXPECT_LT(last_input_type, last_selection); |
2168 } | 2168 } |
2169 | 2169 |
2170 class SuppressErrorPageTest : public RenderViewTest { | 2170 class SuppressErrorPageTest : public RenderViewTest { |
2171 public: | 2171 public: |
2172 virtual ContentRendererClient* CreateContentRendererClient() OVERRIDE { | 2172 virtual ContentRendererClient* CreateContentRendererClient() override { |
2173 return new TestContentRendererClient; | 2173 return new TestContentRendererClient; |
2174 } | 2174 } |
2175 | 2175 |
2176 RenderViewImpl* view() { | 2176 RenderViewImpl* view() { |
2177 return static_cast<RenderViewImpl*>(view_); | 2177 return static_cast<RenderViewImpl*>(view_); |
2178 } | 2178 } |
2179 | 2179 |
2180 RenderFrameImpl* frame() { | 2180 RenderFrameImpl* frame() { |
2181 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame()); | 2181 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame()); |
2182 } | 2182 } |
2183 | 2183 |
2184 private: | 2184 private: |
2185 class TestContentRendererClient : public ContentRendererClient { | 2185 class TestContentRendererClient : public ContentRendererClient { |
2186 public: | 2186 public: |
2187 virtual bool ShouldSuppressErrorPage(RenderFrame* render_frame, | 2187 virtual bool ShouldSuppressErrorPage(RenderFrame* render_frame, |
2188 const GURL& url) OVERRIDE { | 2188 const GURL& url) override { |
2189 return url == GURL("http://example.com/suppress"); | 2189 return url == GURL("http://example.com/suppress"); |
2190 } | 2190 } |
2191 | 2191 |
2192 virtual void GetNavigationErrorStrings( | 2192 virtual void GetNavigationErrorStrings( |
2193 content::RenderView* render_view, | 2193 content::RenderView* render_view, |
2194 blink::WebFrame* frame, | 2194 blink::WebFrame* frame, |
2195 const blink::WebURLRequest& failed_request, | 2195 const blink::WebURLRequest& failed_request, |
2196 const blink::WebURLError& error, | 2196 const blink::WebURLError& error, |
2197 std::string* error_html, | 2197 std::string* error_html, |
2198 base::string16* error_description) OVERRIDE { | 2198 base::string16* error_description) override { |
2199 if (error_html) | 2199 if (error_html) |
2200 *error_html = "A suffusion of yellow."; | 2200 *error_html = "A suffusion of yellow."; |
2201 } | 2201 } |
2202 }; | 2202 }; |
2203 }; | 2203 }; |
2204 | 2204 |
2205 #if defined(OS_ANDROID) | 2205 #if defined(OS_ANDROID) |
2206 // Crashing on Android: http://crbug.com/311341 | 2206 // Crashing on Android: http://crbug.com/311341 |
2207 #define MAYBE_Suppresses DISABLED_Suppresses | 2207 #define MAYBE_Suppresses DISABLED_Suppresses |
2208 #else | 2208 #else |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2499 ProcessPendingMessages(); | 2499 ProcessPendingMessages(); |
2500 base::Time after_navigation = | 2500 base::Time after_navigation = |
2501 base::Time::Now() + base::TimeDelta::FromDays(1); | 2501 base::Time::Now() + base::TimeDelta::FromDays(1); |
2502 | 2502 |
2503 base::Time late_nav_reported_start = | 2503 base::Time late_nav_reported_start = |
2504 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2504 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
2505 EXPECT_LE(late_nav_reported_start, after_navigation); | 2505 EXPECT_LE(late_nav_reported_start, after_navigation); |
2506 } | 2506 } |
2507 | 2507 |
2508 } // namespace content | 2508 } // namespace content |
OLD | NEW |