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

Side by Side Diff: content/browser/gpu/gpu_data_manager_impl_private_unittest.cc

Issue 1708783002: Mustash: move content::GPUVideoMemoryUsageStats to gpu::VideoMemoryUsageStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "content/browser/gpu/gpu_data_manager_impl_private.h" 13 #include "content/browser/gpu/gpu_data_manager_impl_private.h"
14 #include "content/public/browser/gpu_data_manager_observer.h" 14 #include "content/public/browser/gpu_data_manager_observer.h"
15 #include "gpu/config/gpu_feature_type.h" 15 #include "gpu/config/gpu_feature_type.h"
16 #include "gpu/config/gpu_info.h" 16 #include "gpu/config/gpu_info.h"
17 #include "gpu/config/gpu_switches.h" 17 #include "gpu/config/gpu_switches.h"
18 #include "gpu/ipc/common/memory_stats.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 #if defined(OS_WIN) 22 #if defined(OS_WIN)
22 #include "base/win/windows_version.h" 23 #include "base/win/windows_version.h"
23 #endif 24 #endif
24 25
25 #define LONG_STRING_CONST(...) #__VA_ARGS__ 26 #define LONG_STRING_CONST(...) #__VA_ARGS__
26 27
27 namespace content { 28 namespace content {
28 namespace { 29 namespace {
29 30
30 class TestObserver : public GpuDataManagerObserver { 31 class TestObserver : public GpuDataManagerObserver {
31 public: 32 public:
32 TestObserver() 33 TestObserver()
33 : gpu_info_updated_(false), 34 : gpu_info_updated_(false),
34 video_memory_usage_stats_updated_(false) { 35 video_memory_usage_stats_updated_(false) {
35 } 36 }
36 ~TestObserver() override {} 37 ~TestObserver() override {}
37 38
38 bool gpu_info_updated() const { return gpu_info_updated_; } 39 bool gpu_info_updated() const { return gpu_info_updated_; }
39 bool video_memory_usage_stats_updated() const { 40 bool video_memory_usage_stats_updated() const {
40 return video_memory_usage_stats_updated_; 41 return video_memory_usage_stats_updated_;
41 } 42 }
42 43
43 void OnGpuInfoUpdate() override { gpu_info_updated_ = true; } 44 void OnGpuInfoUpdate() override { gpu_info_updated_ = true; }
44 45
45 void OnVideoMemoryUsageStatsUpdate( 46 void OnVideoMemoryUsageStatsUpdate(
46 const GPUVideoMemoryUsageStats& stats) override { 47 const gpu::VideoMemoryUsageStats& stats) override {
47 video_memory_usage_stats_updated_ = true; 48 video_memory_usage_stats_updated_ = true;
48 } 49 }
49 50
50 void Reset() { 51 void Reset() {
51 gpu_info_updated_ = false; 52 gpu_info_updated_ = false;
52 video_memory_usage_stats_updated_ = false; 53 video_memory_usage_stats_updated_ = false;
53 } 54 }
54 55
55 private: 56 private:
56 bool gpu_info_updated_; 57 bool gpu_info_updated_;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 350
350 TestObserver observer; 351 TestObserver observer;
351 manager->AddObserver(&observer); 352 manager->AddObserver(&observer);
352 353
353 { 354 {
354 base::RunLoop run_loop; 355 base::RunLoop run_loop;
355 run_loop.RunUntilIdle(); 356 run_loop.RunUntilIdle();
356 } 357 }
357 EXPECT_FALSE(observer.video_memory_usage_stats_updated()); 358 EXPECT_FALSE(observer.video_memory_usage_stats_updated());
358 359
359 GPUVideoMemoryUsageStats vram_stats; 360 gpu::VideoMemoryUsageStats vram_stats;
360 manager->UpdateVideoMemoryUsageStats(vram_stats); 361 manager->UpdateVideoMemoryUsageStats(vram_stats);
361 { 362 {
362 base::RunLoop run_loop; 363 base::RunLoop run_loop;
363 run_loop.RunUntilIdle(); 364 run_loop.RunUntilIdle();
364 } 365 }
365 EXPECT_TRUE(observer.video_memory_usage_stats_updated()); 366 EXPECT_TRUE(observer.video_memory_usage_stats_updated());
366 } 367 }
367 368
368 base::Time GpuDataManagerImplPrivateTest::JustBeforeExpiration( 369 base::Time GpuDataManagerImplPrivateTest::JustBeforeExpiration(
369 const GpuDataManagerImplPrivate* manager) { 370 const GpuDataManagerImplPrivate* manager) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1)); 775 EXPECT_TRUE(manager->UpdateActiveGpu(0x8086, 0x04a1));
775 { 776 {
776 base::RunLoop run_loop; 777 base::RunLoop run_loop;
777 run_loop.RunUntilIdle(); 778 run_loop.RunUntilIdle();
778 } 779 }
779 EXPECT_TRUE(observer.gpu_info_updated()); 780 EXPECT_TRUE(observer.gpu_info_updated());
780 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount()); 781 EXPECT_EQ(1u, manager->GetBlacklistedFeatureCount());
781 } 782 }
782 783
783 } // namespace content 784 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_data_manager_impl_private.cc ('k') | content/browser/gpu/gpu_process_host_ui_shim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698