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_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/test/automation/tab_proxy.h" | 14 #include "chrome/test/automation/tab_proxy.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
16 #include "chrome/test/perf/perf_test.h" | 16 #include "chrome/test/perf/perf_test.h" |
17 #include "chrome/test/ui/javascript_test_util.h" | 17 #include "chrome/test/ui/javascript_test_util.h" |
18 #include "chrome/test/ui/ui_perf_test.h" | 18 #include "chrome/test/ui/ui_perf_test.h" |
| 19 #include "content/public/test/browser_test_utils.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 const char kRunDromaeo[] = "run-dromaeo-benchmark"; | 25 const char kRunDromaeo[] = "run-dromaeo-benchmark"; |
25 | 26 |
26 class DromaeoTest : public UIPerfTest { | 27 class DromaeoTest : public UIPerfTest { |
27 public: | 28 public: |
28 typedef std::map<std::string, std::string> ResultsMap; | 29 typedef std::map<std::string, std::string> ResultsMap; |
29 | 30 |
30 DromaeoTest() : reference_(false) { | 31 DromaeoTest() : reference_(false) { |
31 dom_automation_enabled_ = true; | 32 dom_automation_enabled_ = true; |
32 show_window_ = true; | 33 show_window_ = true; |
33 } | 34 } |
34 | 35 |
35 void RunTest(const std::string& suite) { | 36 void RunTest(const std::string& suite) { |
36 FilePath test_path = GetDromaeoDir(); | 37 FilePath test_path = GetDromaeoDir(); |
37 std::string query_string = suite + "&automated"; | 38 std::string query_string = suite + "&automated"; |
38 test_path = test_path.Append(FILE_PATH_LITERAL("index.html")); | 39 test_path = test_path.Append(FILE_PATH_LITERAL("index.html")); |
39 GURL test_url(ui_test_utils::GetFileUrlWithQuery(test_path, query_string)); | 40 GURL test_url(content::GetFileUrlWithQuery(test_path, query_string)); |
40 | 41 |
41 scoped_refptr<TabProxy> tab(GetActiveTab()); | 42 scoped_refptr<TabProxy> tab(GetActiveTab()); |
42 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); | 43 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url)); |
43 | 44 |
44 // Wait for the test to finish. | 45 // Wait for the test to finish. |
45 ASSERT_TRUE(WaitUntilTestCompletes(tab.get(), test_url)); | 46 ASSERT_TRUE(WaitUntilTestCompletes(tab.get(), test_url)); |
46 | 47 |
47 PrintResults(tab.get()); | 48 PrintResults(tab.get()); |
48 } | 49 } |
49 | 50 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 157 |
157 TEST_F(DromaeoReferenceTest, JSLibPerf) { | 158 TEST_F(DromaeoReferenceTest, JSLibPerf) { |
158 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDromaeo)) | 159 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDromaeo)) |
159 return; | 160 return; |
160 | 161 |
161 RunTest("jslib"); | 162 RunTest("jslib"); |
162 } | 163 } |
163 | 164 |
164 | 165 |
165 } // namespace | 166 } // namespace |
OLD | NEW |