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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 1140813005: Fix RenderWidgetHostViewAuraTest failure on devices with little memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/sys_info.h"
14 #include "cc/output/compositor_frame.h" 15 #include "cc/output/compositor_frame.h"
15 #include "cc/output/compositor_frame_metadata.h" 16 #include "cc/output/compositor_frame_metadata.h"
16 #include "cc/output/copy_output_request.h" 17 #include "cc/output/copy_output_request.h"
17 #include "cc/surfaces/surface.h" 18 #include "cc/surfaces/surface.h"
18 #include "cc/surfaces/surface_manager.h" 19 #include "cc/surfaces/surface_manager.h"
19 #include "content/browser/browser_thread_impl.h" 20 #include "content/browser/browser_thread_impl.h"
20 #include "content/browser/compositor/resize_lock.h" 21 #include "content/browser/compositor/resize_lock.h"
21 #include "content/browser/compositor/test/no_transport_image_transport_factory.h " 22 #include "content/browser/compositor/test/no_transport_image_transport_factory.h "
22 #include "content/browser/frame_host/render_widget_host_view_guest.h" 23 #include "content/browser/frame_host/render_widget_host_view_guest.h"
23 #include "content/browser/renderer_host/input/web_input_event_util.h" 24 #include "content/browser/renderer_host/input/web_input_event_util.h"
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 views[i]->Destroy(); 2042 views[i]->Destroy();
2042 delete hosts[i]; 2043 delete hosts[i];
2043 } 2044 }
2044 } 2045 }
2045 2046
2046 // Test that changing the memory pressure should delete saved frames. This test 2047 // Test that changing the memory pressure should delete saved frames. This test
2047 // only applies to ChromeOS. 2048 // only applies to ChromeOS.
2048 TEST_F(RenderWidgetHostViewAuraTest, DiscardDelegatedFramesWithMemoryPressure) { 2049 TEST_F(RenderWidgetHostViewAuraTest, DiscardDelegatedFramesWithMemoryPressure) {
2049 view_->InitAsChild(NULL); 2050 view_->InitAsChild(NULL);
2050 2051
2052 // Test logic doesn't work on devices with <= 256MB RAM.
2053 if (base::SysInfo::AmountOfPhysicalMemoryMB() <= 256)
danakj 2015/05/15 23:55:13 Can you instead mock out/inject test behaviour so
halliwell 2015/05/16 00:11:18 Sure ... I will need to dig a bit deeper into exac
2054 return;
2055
2051 size_t max_renderer_frames = 2056 size_t max_renderer_frames =
2052 RendererFrameManager::GetInstance()->GetMaxNumberOfSavedFrames(); 2057 RendererFrameManager::GetInstance()->GetMaxNumberOfSavedFrames();
2053 ASSERT_LE(2u, max_renderer_frames); 2058 ASSERT_LE(2u, max_renderer_frames);
2054 size_t renderer_count = max_renderer_frames; 2059 size_t renderer_count = max_renderer_frames;
2055 gfx::Rect view_rect(100, 100); 2060 gfx::Rect view_rect(100, 100);
2056 gfx::Size frame_size = view_rect.size(); 2061 gfx::Size frame_size = view_rect.size();
2057 DCHECK_EQ(0u, HostSharedBitmapManager::current()->AllocatedBitmapCount()); 2062 DCHECK_EQ(0u, HostSharedBitmapManager::current()->AllocatedBitmapCount());
2058 2063
2059 scoped_ptr<RenderWidgetHostImpl * []> hosts( 2064 scoped_ptr<RenderWidgetHostImpl * []> hosts(
2060 new RenderWidgetHostImpl* [renderer_count]); 2065 new RenderWidgetHostImpl* [renderer_count]);
(...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after
3465 ViewMsg_SetSurfaceIdNamespace::Read(msg, &params); 3470 ViewMsg_SetSurfaceIdNamespace::Read(msg, &params);
3466 view_->InitAsChild(NULL); 3471 view_->InitAsChild(NULL);
3467 view_->Show(); 3472 view_->Show();
3468 view_->SetSize(size); 3473 view_->SetSize(size);
3469 view_->OnSwapCompositorFrame(0, 3474 view_->OnSwapCompositorFrame(0,
3470 MakeDelegatedFrame(1.f, size, gfx::Rect(size))); 3475 MakeDelegatedFrame(1.f, size, gfx::Rect(size)));
3471 EXPECT_EQ(view_->GetSurfaceIdNamespace(), get<0>(params)); 3476 EXPECT_EQ(view_->GetSurfaceIdNamespace(), get<0>(params));
3472 } 3477 }
3473 3478
3474 } // namespace content 3479 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698