Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Unified Diff: chrome/test/perf/page_cycler_test.cc

Issue 7904005: Wait for test script to be loaded before calling __get_timings. See detailed analysis in crbug.co... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) { \
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698