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

Side by Side Diff: content/renderer/renderer_webapplicationcachehost_impl.cc

Issue 16026006: Introduce the notion of a "layout test mode" instead of turning individual flags on and off (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/renderer/renderer_webapplicationcachehost_impl.h" 5 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
6 6
7 #include "content/common/view_messages.h" 7 #include "content/common/view_messages.h"
8 #include "content/renderer/render_thread_impl.h" 8 #include "content/renderer/render_thread_impl.h"
9 #include "content/renderer/render_view_impl.h" 9 #include "content/renderer/render_view_impl.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
12 12
13 using appcache::AppCacheBackend; 13 using appcache::AppCacheBackend;
14 using WebKit::WebApplicationCacheHostClient; 14 using WebKit::WebApplicationCacheHostClient;
15 using WebKit::WebConsoleMessage; 15 using WebKit::WebConsoleMessage;
16 16
17 namespace content { 17 namespace content {
18 18
19 static bool g_disable_logging = false;
20
21 RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl( 19 RendererWebApplicationCacheHostImpl::RendererWebApplicationCacheHostImpl(
22 RenderViewImpl* render_view, 20 RenderViewImpl* render_view,
23 WebApplicationCacheHostClient* client, 21 WebApplicationCacheHostClient* client,
24 AppCacheBackend* backend) 22 AppCacheBackend* backend)
25 : WebApplicationCacheHostImpl(client, backend), 23 : WebApplicationCacheHostImpl(client, backend),
26 routing_id_(render_view->routing_id()) { 24 routing_id_(render_view->routing_id()) {
27 } 25 }
28 26
29 void RendererWebApplicationCacheHostImpl::OnLogMessage( 27 void RendererWebApplicationCacheHostImpl::OnLogMessage(
30 appcache::LogLevel log_level, const std::string& message) { 28 appcache::LogLevel log_level, const std::string& message) {
31 if (g_disable_logging) 29 if (RenderThreadImpl::current()->layout_test_mode())
32 return; 30 return;
33 31
34 RenderViewImpl* render_view = GetRenderView(); 32 RenderViewImpl* render_view = GetRenderView();
35 if (!render_view || !render_view->webview() || 33 if (!render_view || !render_view->webview() ||
36 !render_view->webview()->mainFrame()) 34 !render_view->webview()->mainFrame())
37 return; 35 return;
38 36
39 WebKit::WebFrame* frame = render_view->webview()->mainFrame(); 37 WebKit::WebFrame* frame = render_view->webview()->mainFrame();
40 frame->addMessageToConsole(WebConsoleMessage( 38 frame->addMessageToConsole(WebConsoleMessage(
41 static_cast<WebConsoleMessage::Level>(log_level), 39 static_cast<WebConsoleMessage::Level>(log_level),
(...skipping 12 matching lines...) Expand all
54 RenderThreadImpl::current()->Send(new ViewHostMsg_AppCacheAccessed( 52 RenderThreadImpl::current()->Send(new ViewHostMsg_AppCacheAccessed(
55 routing_id_, info.manifest_url, false)); 53 routing_id_, info.manifest_url, false));
56 } 54 }
57 WebApplicationCacheHostImpl::OnCacheSelected(info); 55 WebApplicationCacheHostImpl::OnCacheSelected(info);
58 } 56 }
59 57
60 RenderViewImpl* RendererWebApplicationCacheHostImpl::GetRenderView() { 58 RenderViewImpl* RendererWebApplicationCacheHostImpl::GetRenderView() {
61 return RenderViewImpl::FromRoutingID(routing_id_); 59 return RenderViewImpl::FromRoutingID(routing_id_);
62 } 60 }
63 61
64 // static
65 void RendererWebApplicationCacheHostImpl::DisableLoggingForTesting() {
66 g_disable_logging = true;
67 }
68
69 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webapplicationcachehost_impl.h ('k') | content/shell/app/shell_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698