summaryrefslogtreecommitdiffstats
path: root/chrome/test/memory_test
diff options
context:
space:
mode:
authorhnguyen@chromium.org <hnguyen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-26 21:00:45 +0000
committerhnguyen@chromium.org <hnguyen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-26 21:00:45 +0000
commit7f072f44076c3615b4741f20daf05ea75535ead6 (patch)
treee63c29c873eef2ff96f56606f68ff62279d8d481 /chrome/test/memory_test
parentf4399ae2b9dfec9bd99d8ad90be4936a79cf8ab7 (diff)
downloadchromium_src-7f072f44076c3615b4741f20daf05ea75535ead6.zip
chromium_src-7f072f44076c3615b4741f20daf05ea75535ead6.tar.gz
chromium_src-7f072f44076c3615b4741f20daf05ea75535ead6.tar.bz2
Resubmit GPU memory test after updating DEPS to pull in latest test data.
Previous review: http://codereview.chromium.org/6676002/ Review URL: http://codereview.chromium.org/6854024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83070 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/memory_test')
-rw-r--r--chrome/test/memory_test/memory_test.cc124
1 files changed, 111 insertions, 13 deletions
diff --git a/chrome/test/memory_test/memory_test.cc b/chrome/test/memory_test/memory_test.cc
index 29e7d27..95bb442 100644
--- a/chrome/test/memory_test/memory_test.cc
+++ b/chrome/test/memory_test/memory_test.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,11 +9,13 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_util.h"
+#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/url_constants.h"
#include "chrome/test/automation/browser_proxy.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
@@ -63,6 +65,14 @@ class MemoryTest : public UIPerfTest {
return dir;
}
+ static FilePath GetTestDataDirectory() {
+ FilePath profile_dir;
+ EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &profile_dir));
+ profile_dir = profile_dir.AppendASCII("data");
+ profile_dir = profile_dir.AppendASCII("memory_test");
+ return profile_dir;
+ }
+
virtual void SetUp() {
show_window_ = true;
@@ -275,12 +285,7 @@ class MemoryTest : public UIPerfTest {
class GeneralMixMemoryTest : public MemoryTest {
public:
virtual FilePath GetUserDataDirSource() const {
- FilePath profile_dir;
- PathService::Get(base::DIR_SOURCE_ROOT, &profile_dir);
- profile_dir = profile_dir.AppendASCII("data");
- profile_dir = profile_dir.AppendASCII("memory_test");
- profile_dir = profile_dir.AppendASCII("general_mix");
- return profile_dir;
+ return GetTestDataDirectory().AppendASCII("general_mix");
}
virtual size_t GetUrlList(std::string** list) {
@@ -439,12 +444,7 @@ class MembusterMemoryTest : public MemoryTest {
}
virtual FilePath GetUserDataDirSource() const {
- FilePath profile_dir;
- PathService::Get(base::DIR_SOURCE_ROOT, &profile_dir);
- profile_dir = profile_dir.AppendASCII("data");
- profile_dir = profile_dir.AppendASCII("memory_test");
- profile_dir = profile_dir.AppendASCII("membuster");
- return profile_dir;
+ return GetTestDataDirectory().AppendASCII("membuster");
}
virtual size_t GetUrlList(std::string** list) {
@@ -519,6 +519,100 @@ std::string MembusterMemoryTest::source_urls_[] = {
size_t MembusterMemoryTest::urls_length_ =
arraysize(MembusterMemoryTest::source_urls_);
+class GPUMemoryTest : public MemoryTest {
+ public:
+ virtual FilePath GetUserDataDirSource() const {
+ return GetTestDataDirectory().AppendASCII("gpu");
+ }
+
+ virtual size_t GetUrlList(std::string** list) {
+ *list = urls_;
+ return urls_length_;
+ }
+
+ void RunTest(const char* test_name, int num_target_tabs) {
+ std::string* urls;
+ size_t urls_length = GetUrlList(&urls);
+
+ // Record the initial CommitCharge. This is a system-wide measurement,
+ // so if other applications are running, they can create variance in this
+ // test.
+ size_t start_size = base::GetSystemCommitCharge();
+
+ // Increase execution timeout due to slow loading of WebGL contents.
+ set_action_timeout_ms(TestTimeouts::large_test_timeout_ms());
+
+ // Cycle through the URLs.
+ scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(window.get());
+ scoped_refptr<TabProxy> tab(window->GetActiveTab());
+ ASSERT_TRUE(tab.get());
+
+ int expected_tab_count = 1;
+
+ for (int counter = 0; counter < num_target_tabs; ++counter) {
+ if (static_cast<size_t>(counter) >= urls_length)
+ break;
+
+ std::string name = StringPrintf("%s_%dof%d_tabs_opened",
+ test_name, counter + 1, num_target_tabs);
+ std::string url = urls[counter];
+
+ SCOPED_TRACE(url);
+ EXPECT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS,
+ tab->NavigateToURL(GURL(urls[counter])));
+
+ size_t stop_size = base::GetSystemCommitCharge();
+ PrintIOPerfInfo(name.c_str());
+ PrintMemoryUsageInfo(name.c_str());
+ PrintSystemCommitCharge(name.c_str(), stop_size - start_size,
+ true /* important */);
+
+ if (GetTabCount() < num_target_tabs) {
+ EXPECT_TRUE(window->AppendTab(GURL(chrome::kAboutBlankURL)));
+ expected_tab_count++;
+ WaitUntilTabCount(expected_tab_count);
+ tab = window->GetActiveTab();
+ ASSERT_TRUE(tab.get());
+ continue;
+ }
+ }
+
+ for (int counter = 1; counter <= num_target_tabs - 1; ++counter) {
+ std::string name = StringPrintf("%s_%dof%d_tabs_closed", test_name,
+ counter, num_target_tabs);
+ tab = window->GetActiveTab();
+ ASSERT_TRUE(tab->Close(true));
+ size_t stop_size = base::GetSystemCommitCharge();
+ PrintIOPerfInfo(name.c_str());
+ PrintMemoryUsageInfo(name.c_str());
+ PrintSystemCommitCharge(name.c_str(), stop_size - start_size,
+ true /* important */);
+ }
+
+ size_t stop_size = base::GetSystemCommitCharge();
+ PrintIOPerfInfo(test_name);
+ PrintMemoryUsageInfo(test_name);
+ PrintSystemCommitCharge(test_name, stop_size - start_size,
+ true /* important */);
+ }
+
+ private:
+ static std::string urls_[];
+ static size_t urls_length_;
+};
+
+// List of WebGL experiments to use for GPU memory test
+std::string GPUMemoryTest::urls_[] = {
+ "http://webglsamples.googlecode.com/hg/blob/blob.html",
+ "http://webglsamples.googlecode.com/hg/dynamic-cubemap/dynamic-cubemap.html",
+ "http://webglsamples.googlecode.com/hg/field/field.html",
+ "http://webglsamples.googlecode.com/hg/fishtank/fishtank.html",
+ "http://webglsamples.googlecode.com/hg/aquarium/aquarium.html",
+};
+
+size_t GPUMemoryTest::urls_length_ = arraysize(GPUMemoryTest::urls_);
+
TEST_F(GeneralMixMemoryTest, SingleTabTest) {
RunTest("_1t", 1);
}
@@ -531,6 +625,10 @@ TEST_F(GeneralMixMemoryTest, TwelveTabTest) {
RunTest("_12t", 12);
}
+TEST_F(GPUMemoryTest, FourTabTest) {
+ RunTest("_gpu", 4);
+}
+
// Commented out until the recorded cache data is added.
//TEST_F(MembusterMemoryTest, Windows) {
// RunTest("membuster", 0);