diff options
author | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 20:04:09 +0000 |
---|---|---|
committer | pinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-10 20:04:09 +0000 |
commit | a03c3ab2b239f5617b70956f6af1f2ea6682d26f (patch) | |
tree | 006dd1a0e2b894116510f30bcc195d9d6490d50e /webkit/glue/resource_fetcher_unittest.cc | |
parent | f08e7583ec3d6e9ee79585c03b16ad3a70de2b02 (diff) | |
download | chromium_src-a03c3ab2b239f5617b70956f6af1f2ea6682d26f.zip chromium_src-a03c3ab2b239f5617b70956f6af1f2ea6682d26f.tar.gz chromium_src-a03c3ab2b239f5617b70956f6af1f2ea6682d26f.tar.bz2 |
make a target for test_shell_tests on mac and tweak tests to build there. Include a few more files to be built in glue upon which they depend.
Review URL: http://codereview.chromium.org/13712
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6733 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/resource_fetcher_unittest.cc')
-rw-r--r-- | webkit/glue/resource_fetcher_unittest.cc | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc index cad4bbc..d996f3b 100644 --- a/webkit/glue/resource_fetcher_unittest.cc +++ b/webkit/glue/resource_fetcher_unittest.cc @@ -79,6 +79,15 @@ class FetcherDelegate : public ResourceFetcher::Delegate { &FetcherDelegate::TimerCallback); #elif defined(OS_LINUX) timer_id_ = g_timeout_add(interval, &FetcherDelegate::TimerCallback, NULL); +#elif defined(OS_MACOSX) + // CFAbsoluteTime is in seconds and |interval| is in ms, so make sure we + // keep the units correct. + CFTimeInterval interval_in_seconds = static_cast<double>(interval) / 1000.0; + CFAbsoluteTime fire_date = + CFAbsoluteTimeGetCurrent() + interval_in_seconds; + timer_id_ = CFRunLoopTimerCreate(NULL, fire_date, interval_in_seconds, 0, + 0, FetcherDelegate::TimerCallback, NULL); + CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer_id_, kCFRunLoopCommonModes); #endif } @@ -87,6 +96,10 @@ class FetcherDelegate : public ResourceFetcher::Delegate { ::KillTimer(NULL, timer_id_); #elif defined(OS_LINUX) g_source_remove(timer_id_); +#elif defined(OS_MACOSX) + CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer_id_, + kCFRunLoopCommonModes); + CFRelease(timer_id_); #endif } @@ -101,6 +114,10 @@ class FetcherDelegate : public ResourceFetcher::Delegate { instance_->TimerFired(); return true; } +#elif defined(OS_MACOSX) + static void TimerCallback(CFRunLoopTimerRef timer, void* info) { + instance_->TimerFired(); + } #endif void TimerFired() { @@ -123,6 +140,8 @@ class FetcherDelegate : public ResourceFetcher::Delegate { UINT_PTR timer_id_; #elif defined(OS_LINUX) guint timer_id_; +#elif defined(OS_MACOSX) + CFRunLoopTimerRef timer_id_; #endif bool completed_; int time_elapsed_ms_; @@ -132,8 +151,6 @@ class FetcherDelegate : public ResourceFetcher::Delegate { FetcherDelegate* FetcherDelegate::instance_ = NULL; -} // namespace - // Test a fetch from the test server. TEST_F(ResourceFetcherTests, ResourceFetcherDownload) { UnittestTestServer server; @@ -215,3 +232,4 @@ TEST_F(ResourceFetcherTests, ResourceFetcherTimeout) { EXPECT_TRUE(delegate->time_elapsed_ms() < kMaxWaitTimeMs); } +} // namespace |