DescriptionRevert 144807 - Rewrite DownloadsApiTest in C++.
Caused a compile error on Linux ChromiumOS Clang:
chrome/browser/extensions/api/downloads/downloads_api_unittest.cc:1581:44: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]
" \"filename\": \"unsafe-header-%lu.txt\","
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
./testing/gtest/include/gtest/gtest.h:1924:70: note: expanded from macro 'EXPECT_STREQ'
EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
^
testing/gtest/include/gtest/gtest_pred_impl.h:162:40: note: expanded from macro 'EXPECT_PRED_FORMAT2'
GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
^
testing/gtest/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
^
testing/gtest/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
if (const ::testing::AssertionResult gtest_ar = (expression)) \
^~~~~~~~~~
This uses much less magic than the javascript version, so it's more robust and easier to debug and fix.
Aaron is the primary reviewer since most of this is extensions-specific.
Randy, none of this is particularly downloads-specific. You're welcome to review or mute.
ExtensionDownloadsEventRouter sends a chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT notification whenever it fires an event.
DownloadsEventsListener is-a content::NotificationObserver that listens for chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT and logs them. DEL facilitates waiting for specific events by running the message loops, optionally with a timeout to prevent hitting the 45s hard timeout. If a WaitFor() call times out, then it prints the events that it was waiting for along with the events that it received to aid debugging.
BrowserContext::GetFileSystemContext() is used to create HTML5 FileSystem Files.
Empty extensions are used because DownloadsDownloadFunction relies on its host permissions mechanisms.
I considered grouping all of the new TEST_Fs in a single large TEST_F in order to amortize start-up cost, but that would have required a comment explaining how to disable sub-sections, and it would have complicated time-outs. Besides, most bots can parallelize.
Review URL: https://chromiumcodereview.appspot.com/10542038
TBR=benjhayden@chromium.org
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=144813
Patch Set 1 #Messages
Total messages: 2 (0 generated)
|