Index: chrome/test/perf/indexeddb_uitest.cc |
diff --git a/chrome/test/perf/sunspider_uitest.cc b/chrome/test/perf/indexeddb_uitest.cc |
similarity index 60% |
copy from chrome/test/perf/sunspider_uitest.cc |
copy to chrome/test/perf/indexeddb_uitest.cc |
index 8a0961e2009a6ff9c865cbc918a7f0c48c2feb27..dee06183c6c8112155c25ab388f0dd49f8a37b7c 100644 |
--- a/chrome/test/perf/sunspider_uitest.cc |
+++ b/chrome/test/perf/indexeddb_uitest.cc |
@@ -2,14 +2,12 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/command_line.h" |
-#include "base/file_util.h" |
+#include "base/file_path.h" |
#include "base/path_service.h" |
-#include "base/string_util.h" |
#include "base/test/test_timeouts.h" |
#include "base/utf_string_conversions.h" |
-#include "base/values.h" |
#include "chrome/common/chrome_paths.h" |
+#include "chrome/common/automation_constants.h" |
#include "chrome/test/automation/tab_proxy.h" |
#include "chrome/test/perf/perf_test.h" |
#include "chrome/test/ui/javascript_test_util.h" |
@@ -20,22 +18,20 @@ |
namespace { |
static const FilePath::CharType kStartFile[] = |
- FILE_PATH_LITERAL("sunspider-driver.html"); |
+ FILE_PATH_LITERAL("perf_test.html"); |
-const char kRunSunSpider[] = "run-sunspider"; |
- |
-class SunSpiderTest : public UIPerfTest { |
+class IndexedDBTest : public UIPerfTest { |
public: |
typedef std::map<std::string, std::string> ResultsMap; |
- SunSpiderTest() : reference_(false) { |
+ IndexedDBTest() : reference_(false) { |
dom_automation_enabled_ = true; |
show_window_ = true; |
} |
void RunTest() { |
FilePath::StringType start_file(kStartFile); |
- FilePath test_path = GetSunSpiderDir(); |
+ FilePath test_path = GetIndexedDBTestDir(); |
test_path = test_path.Append(start_file); |
GURL test_url(net::FilePathToFileURL(test_path)); |
@@ -53,11 +49,11 @@ class SunSpiderTest : public UIPerfTest { |
bool reference_; // True if this is a reference build. |
private: |
- // Return the path to the SunSpider directory on the local filesystem. |
- FilePath GetSunSpiderDir() { |
+ // Return the path to the IndexedDB test directory on the local filesystem. |
+ FilePath GetIndexedDBTestDir() { |
FilePath test_dir; |
PathService::Get(chrome::DIR_TEST_DATA, &test_dir); |
- return test_dir.AppendASCII("sunspider"); |
+ return test_dir.AppendASCII("indexeddb"); |
} |
bool WaitUntilTestCompletes(TabProxy* tab, const GURL& test_url) { |
@@ -65,27 +61,11 @@ class SunSpiderTest : public UIPerfTest { |
TestTimeouts::large_test_timeout_ms(), "1"); |
} |
- bool GetTotal(TabProxy* tab, std::string* total) { |
- std::wstring total_wide; |
- bool succeeded = tab->ExecuteAndExtractString(L"", |
- L"window.domAutomationController.send(automation.GetTotal());", |
- &total_wide); |
- |
- // Note that we don't use ASSERT_TRUE here (and in some other places) as it |
- // doesn't work inside a function with a return type other than void. |
- EXPECT_TRUE(succeeded); |
- if (!succeeded) |
- return false; |
- |
- total->assign(WideToUTF8(total_wide)); |
- return true; |
- } |
- |
bool GetResults(TabProxy* tab, ResultsMap* results) { |
std::wstring json_wide; |
bool succeeded = tab->ExecuteAndExtractString(L"", |
L"window.domAutomationController.send(" |
- L" JSON.stringify(automation.GetResults()));", |
+ L" JSON.stringify(automation.getResults()));", |
&json_wide); |
EXPECT_TRUE(succeeded); |
@@ -97,48 +77,38 @@ class SunSpiderTest : public UIPerfTest { |
} |
void PrintResults(TabProxy* tab) { |
- std::string total; |
- ASSERT_TRUE(GetTotal(tab, &total)); |
- |
ResultsMap results; |
ASSERT_TRUE(GetResults(tab, &results)); |
std::string trace_name = reference_ ? "t_ref" : "t"; |
- perf_test::PrintResultMeanAndError("total", "", trace_name, total, "ms", |
- true); |
- |
ResultsMap::const_iterator it = results.begin(); |
for (; it != results.end(); ++it) |
perf_test::PrintResultList(it->first, "", trace_name, it->second, "ms", |
false); |
} |
- DISALLOW_COPY_AND_ASSIGN(SunSpiderTest); |
+ DISALLOW_COPY_AND_ASSIGN(IndexedDBTest); |
}; |
-class SunSpiderReferenceTest : public SunSpiderTest { |
+class IndexedDBReferenceTest : public IndexedDBTest { |
public: |
- SunSpiderReferenceTest() : SunSpiderTest() { |
+ IndexedDBReferenceTest() : IndexedDBTest() { |
reference_ = true; |
} |
void SetUp() { |
UseReferenceBuild(); |
- SunSpiderTest::SetUp(); |
+ IndexedDBTest::SetUp(); |
} |
}; |
-TEST_F(SunSpiderTest, Perf) { |
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunSunSpider)) |
- return; |
+TEST_F(IndexedDBTest, Perf) { |
RunTest(); |
} |
-TEST_F(SunSpiderReferenceTest, Perf) { |
- if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunSunSpider)) |
- return; |
+TEST_F(IndexedDBReferenceTest, Perf) { |
RunTest(); |
} |