| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chrome/browser/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <stdint.h> | 8 #include <stdint.h> | 
| 9 | 9 | 
| 10 #include <vector> | 10 #include <vector> | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 457     EXPECT_CALL(item(), GetAutoOpened()) | 457     EXPECT_CALL(item(), GetAutoOpened()) | 
| 458         .WillRepeatedly(Return(test_case.auto_opened)); | 458         .WillRepeatedly(Return(test_case.auto_opened)); | 
| 459 | 459 | 
| 460     EXPECT_EQ(test_case.expected_result, | 460     EXPECT_EQ(test_case.expected_result, | 
| 461               model().ShouldRemoveFromShelfWhenComplete()) | 461               model().ShouldRemoveFromShelfWhenComplete()) | 
| 462         << "Test case: " << i; | 462         << "Test case: " << i; | 
| 463     Mock::VerifyAndClearExpectations(&item()); | 463     Mock::VerifyAndClearExpectations(&item()); | 
| 464     Mock::VerifyAndClearExpectations(&model()); | 464     Mock::VerifyAndClearExpectations(&model()); | 
| 465   } | 465   } | 
| 466 } | 466 } | 
|  | 467 | 
|  | 468 TEST_F(DownloadItemModelTest, GetSetOpenedOrShown) { | 
|  | 469   SetupDownloadItemDefaults(); | 
|  | 470 | 
|  | 471   { | 
|  | 472     // Not set by-default. | 
|  | 473     EXPECT_CALL(item(), GetOpened()).WillRepeatedly(Return(false)); | 
|  | 474     EXPECT_FALSE(model().GetOpenedOrShown()); | 
|  | 475     Mock::VerifyAndClearExpectations(&item()); | 
|  | 476   } | 
|  | 477 | 
|  | 478   // Otherwise, it returns GetOpened() or GetOpenedOrShown(). | 
|  | 479   const struct TestCase { | 
|  | 480     bool opened; | 
|  | 481     bool opened_or_shown; | 
|  | 482     bool expected; | 
|  | 483   } kTestCases[] = { | 
|  | 484     { true,  true,  true }, | 
|  | 485     { true,  false, true }, | 
|  | 486     { false, true,  true }, | 
|  | 487     { false, false, false } | 
|  | 488   }; | 
|  | 489 | 
|  | 490   for (unsigned i = 0; i < arraysize(kTestCases); i++) { | 
|  | 491     const TestCase& test_case = kTestCases[i]; | 
|  | 492     EXPECT_CALL(item(), GetOpened()).WillRepeatedly(Return(test_case.opened)); | 
|  | 493     model().SetOpenedOrShown(test_case.opened_or_shown); | 
|  | 494     EXPECT_EQ(test_case.expected, model().GetOpenedOrShown()) | 
|  | 495       << "Test case: " << i; | 
|  | 496     Mock::VerifyAndClearExpectations(&item()); | 
|  | 497   } | 
|  | 498 } | 
| OLD | NEW | 
|---|