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

Unified Diff: chrome/browser/download/download_item_model_unittest.cc

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. Created 4 years, 1 month 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
Index: chrome/browser/download/download_item_model_unittest.cc
diff --git a/chrome/browser/download/download_item_model_unittest.cc b/chrome/browser/download/download_item_model_unittest.cc
index 7325f00b07b25ae4eba581f975e7309a26d9b690..bd0125e75d65e12db863fec0ff5e4bbc0c7185ed 100644
--- a/chrome/browser/download/download_item_model_unittest.cc
+++ b/chrome/browser/download/download_item_model_unittest.cc
@@ -464,3 +464,35 @@ TEST_F(DownloadItemModelTest, ShouldRemoveFromShelfWhenComplete) {
Mock::VerifyAndClearExpectations(&model());
}
}
+
+TEST_F(DownloadItemModelTest, GetSetOpenedOrShown) {
+ SetupDownloadItemDefaults();
+
+ {
+ // Not set by-default.
+ EXPECT_CALL(item(), GetOpened()).WillRepeatedly(Return(false));
+ EXPECT_FALSE(model().GetOpenedOrShown());
+ Mock::VerifyAndClearExpectations(&item());
+ }
+
+ // Otherwise, it returns GetOpened() or GetOpenedOrShown().
+ const struct TestCase {
+ bool opened;
+ bool opened_or_shown;
+ bool expected;
+ } kTestCases[] = {
+ { true, true, true },
+ { true, false, true },
+ { false, true, true },
+ { false, false, false }
+ };
+
+ for (unsigned i = 0; i < arraysize(kTestCases); i++) {
+ const TestCase& test_case = kTestCases[i];
+ EXPECT_CALL(item(), GetOpened()).WillRepeatedly(Return(test_case.opened));
+ model().SetOpenedOrShown(test_case.opened_or_shown);
+ EXPECT_EQ(test_case.expected, model().GetOpenedOrShown())
+ << "Test case: " << i;
+ Mock::VerifyAndClearExpectations(&item());
+ }
+}
« no previous file with comments | « chrome/browser/download/download_item_model.cc ('k') | chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698