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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (kModifierMap[i].src & modifiers) { | 108 if (kModifierMap[i].src & modifiers) { |
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 WebUIController* CreateWebUIControllerForURL(WebUI* web_ui, |
119 WebUI* web_ui, const GURL& url) const override { | 119 const GURL& url) const override { |
120 return NULL; | 120 return NULL; |
121 } | 121 } |
122 virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 122 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 bool UseWebUIForURL(BrowserContext* browser_context, |
| 127 const GURL& url) const override { |
| 128 return HasWebUIScheme(url); |
| 129 } |
| 130 bool UseWebUIBindingsForURL(BrowserContext* browser_context, |
127 const GURL& url) const override { | 131 const GURL& url) const override { |
128 return HasWebUIScheme(url); | 132 return HasWebUIScheme(url); |
129 } | 133 } |
130 virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context, | |
131 const GURL& url) const override { | |
132 return HasWebUIScheme(url); | |
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 } |
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2164 | 2164 |
2165 EXPECT_TRUE(is_input_type_called); | 2165 EXPECT_TRUE(is_input_type_called); |
2166 EXPECT_TRUE(is_selection_called); | 2166 EXPECT_TRUE(is_selection_called); |
2167 | 2167 |
2168 // InputTypeChange shold be called earlier than SelectionChanged. | 2168 // InputTypeChange shold be called earlier than SelectionChanged. |
2169 EXPECT_LT(last_input_type, last_selection); | 2169 EXPECT_LT(last_input_type, last_selection); |
2170 } | 2170 } |
2171 | 2171 |
2172 class SuppressErrorPageTest : public RenderViewTest { | 2172 class SuppressErrorPageTest : public RenderViewTest { |
2173 public: | 2173 public: |
2174 virtual ContentRendererClient* CreateContentRendererClient() override { | 2174 ContentRendererClient* CreateContentRendererClient() override { |
2175 return new TestContentRendererClient; | 2175 return new TestContentRendererClient; |
2176 } | 2176 } |
2177 | 2177 |
2178 RenderViewImpl* view() { | 2178 RenderViewImpl* view() { |
2179 return static_cast<RenderViewImpl*>(view_); | 2179 return static_cast<RenderViewImpl*>(view_); |
2180 } | 2180 } |
2181 | 2181 |
2182 RenderFrameImpl* frame() { | 2182 RenderFrameImpl* frame() { |
2183 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame()); | 2183 return static_cast<RenderFrameImpl*>(view()->GetMainRenderFrame()); |
2184 } | 2184 } |
2185 | 2185 |
2186 private: | 2186 private: |
2187 class TestContentRendererClient : public ContentRendererClient { | 2187 class TestContentRendererClient : public ContentRendererClient { |
2188 public: | 2188 public: |
2189 virtual bool ShouldSuppressErrorPage(RenderFrame* render_frame, | 2189 bool ShouldSuppressErrorPage(RenderFrame* render_frame, |
2190 const GURL& url) override { | 2190 const GURL& url) override { |
2191 return url == GURL("http://example.com/suppress"); | 2191 return url == GURL("http://example.com/suppress"); |
2192 } | 2192 } |
2193 | 2193 |
2194 virtual void GetNavigationErrorStrings( | 2194 void GetNavigationErrorStrings(content::RenderView* render_view, |
2195 content::RenderView* render_view, | 2195 blink::WebFrame* frame, |
2196 blink::WebFrame* frame, | 2196 const blink::WebURLRequest& failed_request, |
2197 const blink::WebURLRequest& failed_request, | 2197 const blink::WebURLError& error, |
2198 const blink::WebURLError& error, | 2198 std::string* error_html, |
2199 std::string* error_html, | 2199 base::string16* error_description) override { |
2200 base::string16* error_description) override { | |
2201 if (error_html) | 2200 if (error_html) |
2202 *error_html = "A suffusion of yellow."; | 2201 *error_html = "A suffusion of yellow."; |
2203 } | 2202 } |
2204 }; | 2203 }; |
2205 }; | 2204 }; |
2206 | 2205 |
2207 #if defined(OS_ANDROID) | 2206 #if defined(OS_ANDROID) |
2208 // Crashing on Android: http://crbug.com/311341 | 2207 // Crashing on Android: http://crbug.com/311341 |
2209 #define MAYBE_Suppresses DISABLED_Suppresses | 2208 #define MAYBE_Suppresses DISABLED_Suppresses |
2210 #else | 2209 #else |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 ProcessPendingMessages(); | 2500 ProcessPendingMessages(); |
2502 base::Time after_navigation = | 2501 base::Time after_navigation = |
2503 base::Time::Now() + base::TimeDelta::FromDays(1); | 2502 base::Time::Now() + base::TimeDelta::FromDays(1); |
2504 | 2503 |
2505 base::Time late_nav_reported_start = | 2504 base::Time late_nav_reported_start = |
2506 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2505 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
2507 EXPECT_LE(late_nav_reported_start, after_navigation); | 2506 EXPECT_LE(late_nav_reported_start, after_navigation); |
2508 } | 2507 } |
2509 | 2508 |
2510 } // namespace content | 2509 } // namespace content |
OLD | NEW |