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

Unified Diff: content/browser/download/download_item_impl_unittest.cc

Issue 9518008: Add a const overload to DownloadItem::GetExternalData() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Add a comment explaining the const cast" Created 8 years, 10 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 | « content/browser/download/download_item_impl.cc ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item_impl_unittest.cc
diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc
index a794d3fd21979ecf411a1451731d887d5d7f88f6..55bad0e4ee00185d9c0ec1dc5d98fe6d03882efd 100644
--- a/content/browser/download/download_item_impl_unittest.cc
+++ b/content/browser/download/download_item_impl_unittest.cc
@@ -294,9 +294,11 @@ class TestExternalData : public DownloadItem::ExternalData {
TEST_F(DownloadItemTest, ExternalData) {
DownloadItem* item = CreateDownloadItem(DownloadItem::IN_PROGRESS);
+ const DownloadItem* const_item = item;
// Shouldn't be anything there before set.
EXPECT_EQ(NULL, item->GetExternalData(&external_data_test_string));
+ EXPECT_EQ(NULL, const_item->GetExternalData(&external_data_test_string));
TestExternalData* test1(new TestExternalData());
test1->value = 2;
@@ -308,6 +310,13 @@ TEST_F(DownloadItemTest, ExternalData) {
item->GetExternalData(&external_data_test_string));
EXPECT_EQ(test1, test_result);
+ // Ditto for const lookup.
+ const TestExternalData* test_const_result =
+ static_cast<const TestExternalData*>(
+ const_item->GetExternalData(&external_data_test_string));
+ EXPECT_EQ(static_cast<const TestExternalData*>(test1),
+ test_const_result);
+
// Destructor should be called if value overwritten. New value
// should then be retrievable.
TestExternalData* test2(new TestExternalData());
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/public/browser/download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698