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

Side by Side Diff: chrome/test/gpu/gpu_feature_browsertest.cc

Issue 12150004: Category group support/Renamings. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added destructor for CategoryFilter class per CQ failure. Created 7 years, 8 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 | « chrome/test/base/tracing.cc ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/test/trace_event_analyzer.h" 10 #include "base/test/trace_event_analyzer.h"
(...skipping 30 matching lines...) Expand all
41 using trace_analyzer::TraceEventVector; 41 using trace_analyzer::TraceEventVector;
42 42
43 namespace { 43 namespace {
44 44
45 const char kSwapBuffersEvent[] = "SwapBuffers"; 45 const char kSwapBuffersEvent[] = "SwapBuffers";
46 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation"; 46 const char kAcceleratedCanvasCreationEvent[] = "Canvas2DLayerBridgeCreation";
47 const char kWebGLCreationEvent[] = "DrawingBufferCreation"; 47 const char kWebGLCreationEvent[] = "DrawingBufferCreation";
48 48
49 class GpuFeatureTest : public InProcessBrowserTest { 49 class GpuFeatureTest : public InProcessBrowserTest {
50 public: 50 public:
51 GpuFeatureTest() : trace_categories_("test_gpu"), gpu_enabled_(false) {} 51 GpuFeatureTest() : category_patterns_("test_gpu"), gpu_enabled_(false) {}
52 52
53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
54 base::FilePath test_dir; 54 base::FilePath test_dir;
55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 55 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
56 gpu_test_dir_ = test_dir.AppendASCII("gpu"); 56 gpu_test_dir_ = test_dir.AppendASCII("gpu");
57 } 57 }
58 58
59 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 59 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
60 // Do not use mesa if real GPU is required. 60 // Do not use mesa if real GPU is required.
61 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { 61 if (!command_line->HasSwitch(switches::kUseGpuInTests)) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Bypass tests on GPU Linux Debug bots. 118 // Bypass tests on GPU Linux Debug bots.
119 if (gpu_enabled_) 119 if (gpu_enabled_)
120 return; 120 return;
121 #endif 121 #endif
122 #if defined(OS_MACOSX) 122 #if defined(OS_MACOSX)
123 // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required). 123 // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required).
124 if (!IOSurfaceSupport::Initialize()) 124 if (!IOSurfaceSupport::Initialize())
125 return; 125 return;
126 #endif 126 #endif
127 127
128 ASSERT_TRUE(tracing::BeginTracing(trace_categories_)); 128 ASSERT_TRUE(tracing::BeginTracing(category_patterns_));
129 129
130 // Have to use a new tab for the blacklist to work. 130 // Have to use a new tab for the blacklist to work.
131 RunTest(url, NULL, true); 131 RunTest(url, NULL, true);
132 132
133 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_)); 133 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_));
134 134
135 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); 135 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_));
136 analyzer_->AssociateBeginEndEvents(); 136 analyzer_->AssociateBeginEndEvents();
137 TraceEventVector events; 137 TraceEventVector events;
138 138
139 if (!event_name) 139 if (!event_name)
140 return; 140 return;
141 141
142 size_t event_count = 142 size_t event_count =
143 analyzer_->FindEvents(Query::EventNameIs(event_name), &events); 143 analyzer_->FindEvents(Query::EventNameIs(event_name), &events);
144 144
145 if (event_expected) 145 if (event_expected)
146 EXPECT_GT(event_count, 0U); 146 EXPECT_GT(event_count, 0U);
147 else 147 else
148 EXPECT_EQ(event_count, 0U); 148 EXPECT_EQ(event_count, 0U);
149 } 149 }
150 150
151 // Trigger a resize of the chrome window, and use tracing to wait for the 151 // Trigger a resize of the chrome window, and use tracing to wait for the
152 // given |wait_event|. 152 // given |wait_event|.
153 bool ResizeAndWait(const gfx::Rect& new_bounds, 153 bool ResizeAndWait(const gfx::Rect& new_bounds,
154 const char* trace_categories, 154 const char* category_patterns,
155 const char* wait_category, 155 const char* wait_category,
156 const char* wait_event) { 156 const char* wait_event) {
157 if (!tracing::BeginTracingWithWatch(trace_categories, wait_category, 157 if (!tracing::BeginTracingWithWatch(category_patterns, wait_category,
158 wait_event, 1)) 158 wait_event, 1))
159 return false; 159 return false;
160 browser()->window()->SetBounds(new_bounds); 160 browser()->window()->SetBounds(new_bounds);
161 if (!tracing::WaitForWatchEvent(base::TimeDelta())) 161 if (!tracing::WaitForWatchEvent(base::TimeDelta()))
162 return false; 162 return false;
163 if (!tracing::EndTracing(&trace_events_json_)) 163 if (!tracing::EndTracing(&trace_events_json_))
164 return false; 164 return false;
165 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); 165 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_));
166 analyzer_->AssociateBeginEndEvents(); 166 analyzer_->AssociateBeginEndEvents();
167 return true; 167 return true;
168 } 168 }
169 169
170 protected: 170 protected:
171 base::FilePath gpu_test_dir_; 171 base::FilePath gpu_test_dir_;
172 scoped_ptr<TraceAnalyzer> analyzer_; 172 scoped_ptr<TraceAnalyzer> analyzer_;
173 std::string trace_categories_; 173 std::string category_patterns_;
174 std::string trace_events_json_; 174 std::string trace_events_json_;
175 bool gpu_enabled_; 175 bool gpu_enabled_;
176 }; 176 };
177 177
178 #if defined(OS_WIN) 178 #if defined(OS_WIN)
179 // This test is flaky on Windows. http://crbug.com/177113 179 // This test is flaky on Windows. http://crbug.com/177113
180 #define MAYBE_AcceleratedCompositingAllowed DISABLED_AcceleratedCompositingAllow ed 180 #define MAYBE_AcceleratedCompositingAllowed DISABLED_AcceleratedCompositingAllow ed
181 #else 181 #else
182 #define MAYBE_AcceleratedCompositingAllowed AcceleratedCompositingAllowed 182 #define MAYBE_AcceleratedCompositingAllowed AcceleratedCompositingAllowed
183 #endif 183 #endif
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 441 }
442 442
443 443
444 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX) 444 #if defined(OS_WIN) || defined(OS_CHROMEOS) || defined(OS_MACOSX)
445 // http://crbug.com/162343: flaky on Windows and Mac, failing on ChromiumOS. 445 // http://crbug.com/162343: flaky on Windows and Mac, failing on ChromiumOS.
446 #define MAYBE_RafNoDamage DISABLED_RafNoDamage 446 #define MAYBE_RafNoDamage DISABLED_RafNoDamage
447 #else 447 #else
448 #define MAYBE_RafNoDamage RafNoDamage 448 #define MAYBE_RafNoDamage RafNoDamage
449 #endif 449 #endif
450 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_RafNoDamage) { 450 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, MAYBE_RafNoDamage) {
451 trace_categories_ = "-test_*"; 451 category_patterns_ = "-test_*";
452 const base::FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html")); 452 const base::FilePath url(FILE_PATH_LITERAL("feature_raf_no_damage.html"));
453 RunEventTest(url); 453 RunEventTest(url);
454 454
455 if (!analyzer_.get()) 455 if (!analyzer_.get())
456 return; 456 return;
457 457
458 // Search for matching name on begin event or async_begin event (any begin). 458 // Search for matching name on begin event or async_begin event (any begin).
459 Query query_raf = 459 Query query_raf =
460 (Query::EventPhaseIs(TRACE_EVENT_PHASE_BEGIN) || 460 (Query::EventPhaseIs(TRACE_EVENT_PHASE_BEGIN) ||
461 Query::EventPhaseIs(TRACE_EVENT_PHASE_ASYNC_BEGIN)) && 461 Query::EventPhaseIs(TRACE_EVENT_PHASE_ASYNC_BEGIN)) &&
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 base::StringPrintf( 550 base::StringPrintf(
551 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " 551 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d "
552 "Expected %d", offset_i, offsets[offset_i], 552 "Expected %d", offset_i, offsets[offset_i],
553 old_width, new_width, num_creates, expected_creates); 553 old_width, new_width, num_creates, expected_creates);
554 } 554 }
555 } 555 }
556 } 556 }
557 #endif 557 #endif
558 558
559 } // namespace anonymous 559 } // namespace anonymous
OLDNEW
« no previous file with comments | « chrome/test/base/tracing.cc ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698