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/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "content/public/browser/gpu_data_manager.h" | 8 #include "content/public/browser/gpu_data_manager.h" |
9 #include "content/public/browser/gpu_data_manager_observer.h" | 9 #include "content/public/browser/gpu_data_manager_observer.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 class GpuMemoryTest : public content::ContentBrowserTest { | 67 class GpuMemoryTest : public content::ContentBrowserTest { |
68 public: | 68 public: |
69 GpuMemoryTest() | 69 GpuMemoryTest() |
70 : allow_tests_to_run_(false), | 70 : allow_tests_to_run_(false), |
71 has_used_first_shell_(false) { | 71 has_used_first_shell_(false) { |
72 } | 72 } |
73 virtual ~GpuMemoryTest() { | 73 virtual ~GpuMemoryTest() { |
74 } | 74 } |
75 | 75 |
76 virtual void SetUpInProcessBrowserTestFixture() { | 76 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
77 base::FilePath test_dir; | 77 base::FilePath test_dir; |
78 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); | 78 ASSERT_TRUE(PathService::Get(content::DIR_TEST_DATA, &test_dir)); |
79 gpu_test_dir_ = test_dir.AppendASCII("gpu"); | 79 gpu_test_dir_ = test_dir.AppendASCII("gpu"); |
80 } | 80 } |
81 | 81 |
82 virtual void SetUpCommandLine(CommandLine* command_line) { | 82 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
83 command_line->AppendSwitch(switches::kEnableLogging); | 83 command_line->AppendSwitch(switches::kEnableLogging); |
84 command_line->AppendSwitch(switches::kForceCompositingMode); | 84 command_line->AppendSwitch(switches::kForceCompositingMode); |
85 command_line->AppendSwitchASCII(switches::kForceGpuMemAvailableMb, | 85 command_line->AppendSwitchASCII(switches::kForceGpuMemAvailableMb, |
86 kMemoryLimitMBSwitch); | 86 kMemoryLimitMBSwitch); |
87 // Only run this on GPU bots for now. These tests should work with | 87 // Only run this on GPU bots for now. These tests should work with |
88 // any GPU process, but may be slow. | 88 // any GPU process, but may be slow. |
89 if (command_line->HasSwitch(switches::kUseGpuInTests)) { | 89 if (command_line->HasSwitch(switches::kUseGpuInTests)) { |
90 allow_tests_to_run_ = true; | 90 allow_tests_to_run_ = true; |
91 } | 91 } |
92 // Don't enable these tests on Android just yet (they use lots of memory and | 92 // Don't enable these tests on Android just yet (they use lots of memory and |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 content::Shell* tab = CreateNewTab(); | 238 content::Shell* tab = CreateNewTab(); |
239 LoadPage(tab, PAGE_CSS3D, kMemoryLimitMB); | 239 LoadPage(tab, PAGE_CSS3D, kMemoryLimitMB); |
240 // Make sure that the CSS3D page maxes out a single tab's budget (otherwise | 240 // Make sure that the CSS3D page maxes out a single tab's budget (otherwise |
241 // the test doesn't test anything) but still stays under the limit. | 241 // the test doesn't test anything) but still stays under the limit. |
242 EXPECT_TRUE(MemoryUsageInRange( | 242 EXPECT_TRUE(MemoryUsageInRange( |
243 kSingleTabLimitMB - kWiggleRoomMB, | 243 kSingleTabLimitMB - kWiggleRoomMB, |
244 kMemoryLimitMB + kWiggleRoomMB)); | 244 kMemoryLimitMB + kWiggleRoomMB)); |
245 } | 245 } |
246 | 246 |
247 } // namespace | 247 } // namespace |
OLD | NEW |