Chromium Code Reviews| Index: chrome/test/perf/page_cycler_test.cc |
| =================================================================== |
| --- chrome/test/perf/page_cycler_test.cc (revision 101047) |
| +++ chrome/test/perf/page_cycler_test.cc (working copy) |
| @@ -9,6 +9,7 @@ |
| #include "base/path_service.h" |
| #include "base/process_util.h" |
| #include "base/string_number_conversions.h" |
| +#include "base/string_util.h" |
| #include "base/sys_string_conversions.h" |
| #include "base/test/test_timeouts.h" |
| #include "base/utf_string_conversions.h" |
| @@ -139,6 +140,21 @@ |
| "--expose_gc"); |
| } |
| + bool WaitUntilTabURLPathEndWith(TabProxy* tab, |
|
hans
2011/09/15 12:48:00
nit: it should probably be named "...EndsWith()"
|
| + const std::string& url_path, |
| + int64 timeout_ms) { |
| + base::Time end_time = base::Time::Now() + |
| + base::TimeDelta::FromMilliseconds(timeout_ms); |
| + while ((end_time - base::Time::Now()) > base::TimeDelta()) { |
| + GURL url; |
| + EXPECT_TRUE(tab->GetCurrentURL(&url)); |
| + if (EndsWith(url.path(), url_path, true)) |
| + return true; |
| + base::PlatformThread::Sleep(automation::kSleepTime); |
|
Paweł Hajdan Jr.
2011/09/15 17:59:34
Polling is _unacceptable_ . Please wait for an eve
cmp
2011/09/15 23:22:52
I don't think it's a big deal, really. If you rea
Johnny(Jianning) Ding
2011/09/16 00:14:10
Thanks Chase! I have sent a patch to make the data
cmp
2011/09/16 00:18:22
Reviewed. :)
Johnny(Jianning) Ding
2011/09/16 00:48:01
Thanks Chase! Just landed that patch. Base on that
Johnny(Jianning) Ding
2011/09/16 00:55:05
Please hold on the review. I need to change the pa
|
| + } |
| + return false; |
| + } |
| + |
| virtual FilePath GetDataPath(const char* name) { |
| // Make sure the test data is checked out |
| FilePath test_path; |
| @@ -197,6 +213,18 @@ |
| pages->assign(UTF8ToWide(cookie)); |
| ASSERT_FALSE(pages->empty()); |
| + // Make sure the page is navigated to report.html. Otherwise we may |
| + // check __get_timings successfully in the test page, but fail to run |
| + // __get_timings() in report.html because the test script is not loaded. |
| + ASSERT_TRUE(WaitUntilTabURLPathEndWith(tab.get(), "report.html", |
| + TestTimeouts::action_max_timeout_ms())); |
| + // Wait for the test script to be loaded by checking whether __get_timings |
| + // is ready. |
| + ASSERT_TRUE(WaitUntilJavaScriptCondition(tab, L"", |
| + L"window.domAutomationController.send(" |
| + L"typeof(__get_timings)=='function')", |
| + TestTimeouts::action_max_timeout_ms())); |
| + |
| // Get the timing cookie value from the DOM automation. |
| std::wstring wcookie; |
| ASSERT_TRUE(tab->ExecuteAndExtractString(L"", |
| @@ -442,20 +470,18 @@ |
| // This macro simplifies setting up regular and reference build tests |
| // for HTML5 database tests. |
| -// FLAKY http://crbug.com/67918 |
| #define PAGE_CYCLER_DATABASE_TESTS(test, name) \ |
| -TEST_F(PageCyclerDatabaseTest, FLAKY_Database##name##File) { \ |
| +TEST_F(PageCyclerDatabaseTest, Database##name##File) { \ |
| RunTest(test, test, false); \ |
| } \ |
| -TEST_F(PageCyclerDatabaseReferenceTest, FLAKY_Database##name##File) { \ |
| +TEST_F(PageCyclerDatabaseReferenceTest, Database##name##File) { \ |
| RunTest(test, test, false); \ |
| } |
| // This macro simplifies setting up regular and reference build tests |
| // for HTML5 Indexed DB tests. |
| -// FLAKY http://crbug.com/67918 |
| #define PAGE_CYCLER_IDB_TESTS(test, name) \ |
| -TEST_F(PageCyclerIndexedDatabaseTest, FLAKY_IndexedDB##name##File) { \ |
| +TEST_F(PageCyclerIndexedDatabaseTest, IndexedDB##name##File) { \ |
| RunTest(test, test, false); \ |
| } \ |
| TEST_F(PageCyclerIndexedDatabaseReferenceTest, IndexedDB##name##File) { \ |