| 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/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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/test/trace_event_analyzer.h" | 10 #include "base/test/trace_event_analyzer.h" |
| 11 #include "base/version.h" | 11 #include "base/version.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 13 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/tracing.h" | 17 #include "chrome/test/base/tracing.h" |
| 18 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 19 #include "content/public/browser/gpu_data_manager.h" | 19 #include "content/public/browser/gpu_data_manager.h" |
| 20 #include "content/public/common/content_client.h" | 20 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
| 23 #include "gpu/config/gpu_feature_type.h" | 23 #include "gpu/config/gpu_feature_type.h" |
| 24 #include "gpu/config/gpu_info.h" | 24 #include "gpu/config/gpu_info.h" |
| 25 #include "gpu/config/gpu_test_config.h" | 25 #include "gpu/config/gpu_test_config.h" |
| 26 #include "net/base/filename_util.h" | 26 #include "net/base/filename_util.h" |
| 27 #include "ui/gl/gl_implementation.h" | 27 #include "ui/gl/gl_implementation.h" |
| 28 | 28 |
| 29 #if defined(OS_MACOSX) | |
| 30 #include "ui/gl/io_surface_support_mac.h" | |
| 31 #endif | |
| 32 | |
| 33 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 34 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
| 35 #endif | 31 #endif |
| 36 | 32 |
| 37 using content::GpuDataManager; | 33 using content::GpuDataManager; |
| 38 using gpu::GpuFeatureType; | 34 using gpu::GpuFeatureType; |
| 39 using trace_analyzer::Query; | 35 using trace_analyzer::Query; |
| 40 using trace_analyzer::TraceAnalyzer; | 36 using trace_analyzer::TraceAnalyzer; |
| 41 using trace_analyzer::TraceEventVector; | 37 using trace_analyzer::TraceEventVector; |
| 42 | 38 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 107 |
| 112 // Open the URL and check the trace stream for the given event. | 108 // Open the URL and check the trace stream for the given event. |
| 113 void RunEventTest(const base::FilePath& url, | 109 void RunEventTest(const base::FilePath& url, |
| 114 const char* event_name = NULL, | 110 const char* event_name = NULL, |
| 115 bool event_expected = false) { | 111 bool event_expected = false) { |
| 116 #if defined(OS_LINUX) && !defined(NDEBUG) | 112 #if defined(OS_LINUX) && !defined(NDEBUG) |
| 117 // Bypass tests on GPU Linux Debug bots. | 113 // Bypass tests on GPU Linux Debug bots. |
| 118 if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL) | 114 if (gfx::GetGLImplementation() != gfx::kGLImplementationOSMesaGL) |
| 119 return; | 115 return; |
| 120 #endif | 116 #endif |
| 121 #if defined(OS_MACOSX) | |
| 122 // Bypass tests on Mac OSX 10.5 bots (IOSurfaceSupport is now required). | |
| 123 if (!IOSurfaceSupport::Initialize()) | |
| 124 return; | |
| 125 #endif | |
| 126 | 117 |
| 127 ASSERT_TRUE(tracing::BeginTracing(category_patterns_)); | 118 ASSERT_TRUE(tracing::BeginTracing(category_patterns_)); |
| 128 | 119 |
| 129 // Have to use a new tab for the blacklist to work. | 120 // Have to use a new tab for the blacklist to work. |
| 130 RunTest(url, NULL, true); | 121 RunTest(url, NULL, true); |
| 131 | 122 |
| 132 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_)); | 123 ASSERT_TRUE(tracing::EndTracing(&trace_events_json_)); |
| 133 | 124 |
| 134 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); | 125 analyzer_.reset(TraceAnalyzer::Create(trace_events_json_)); |
| 135 analyzer_->AssociateBeginEndEvents(); | 126 analyzer_->AssociateBeginEndEvents(); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 EXPECT_GT(stats.mean_us, 15000.0); | 415 EXPECT_GT(stats.mean_us, 15000.0); |
| 425 | 416 |
| 426 // Print out the trace events upon error to debug failures. | 417 // Print out the trace events upon error to debug failures. |
| 427 if (stats.mean_us <= 15000.0) { | 418 if (stats.mean_us <= 15000.0) { |
| 428 fprintf(stderr, "\n\nTRACE JSON:\n\n%s\n\n", trace_events_json_.c_str()); | 419 fprintf(stderr, "\n\nTRACE JSON:\n\n%s\n\n", trace_events_json_.c_str()); |
| 429 } | 420 } |
| 430 } | 421 } |
| 431 | 422 |
| 432 #if defined(OS_MACOSX) | 423 #if defined(OS_MACOSX) |
| 433 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, IOSurfaceReuse) { | 424 IN_PROC_BROWSER_TEST_F(GpuFeatureTest, IOSurfaceReuse) { |
| 434 if (!IOSurfaceSupport::Initialize()) | |
| 435 return; | |
| 436 | |
| 437 if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot()) | 425 if (gpu::GPUTestBotConfig::GpuBlacklistedOnBot()) |
| 438 return; | 426 return; |
| 439 | 427 |
| 440 const base::FilePath url( | 428 const base::FilePath url( |
| 441 FILE_PATH_LITERAL("feature_compositing_static.html")); | 429 FILE_PATH_LITERAL("feature_compositing_static.html")); |
| 442 base::FilePath test_path = gpu_test_dir_.Append(url); | 430 base::FilePath test_path = gpu_test_dir_.Append(url); |
| 443 ASSERT_TRUE(base::PathExists(test_path)) | 431 ASSERT_TRUE(base::PathExists(test_path)) |
| 444 << "Missing test file: " << test_path.value(); | 432 << "Missing test file: " << test_path.value(); |
| 445 | 433 |
| 446 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path)); | 434 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " | 491 "%d (resize offset %d): IOSurface width %d -> %d; Creates %d " |
| 504 "Expected %d", offset_i, offsets[offset_i], | 492 "Expected %d", offset_i, offsets[offset_i], |
| 505 old_width, new_width, num_creates, expected_creates); | 493 old_width, new_width, num_creates, expected_creates); |
| 506 } | 494 } |
| 507 } | 495 } |
| 508 LOG(INFO) << "finished test"; | 496 LOG(INFO) << "finished test"; |
| 509 } | 497 } |
| 510 #endif | 498 #endif |
| 511 | 499 |
| 512 } // namespace | 500 } // namespace |
| OLD | NEW |