| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // given width. The following test would fail if kLargeTooltipWidth isn't | 260 // given width. The following test would fail if kLargeTooltipWidth isn't |
| 261 // large enough to accomodate all the strings. | 261 // large enough to accomodate all the strings. |
| 262 EXPECT_STREQ( | 262 EXPECT_STREQ( |
| 263 test_case.expected_tooltip, | 263 test_case.expected_tooltip, |
| 264 UTF16ToUTF8(model().GetTooltipText(font_list, | 264 UTF16ToUTF8(model().GetTooltipText(font_list, |
| 265 kLargeTooltipWidth)).c_str()); | 265 kLargeTooltipWidth)).c_str()); |
| 266 | 266 |
| 267 // Check that if the width is small, the returned tooltip only contains | 267 // Check that if the width is small, the returned tooltip only contains |
| 268 // lines of the given width or smaller. | 268 // lines of the given width or smaller. |
| 269 std::vector<string16> lines; | 269 std::vector<string16> lines; |
| 270 string16 truncated_tooltip = | 270 base::string16 truncated_tooltip = |
| 271 model().GetTooltipText(font_list, kSmallTooltipWidth); | 271 model().GetTooltipText(font_list, kSmallTooltipWidth); |
| 272 Tokenize(truncated_tooltip, ASCIIToUTF16("\n"), &lines); | 272 Tokenize(truncated_tooltip, ASCIIToUTF16("\n"), &lines); |
| 273 for (unsigned i = 0; i < lines.size(); ++i) | 273 for (unsigned i = 0; i < lines.size(); ++i) |
| 274 EXPECT_GE(kSmallTooltipWidth, gfx::GetStringWidth(lines[i], font_list)); | 274 EXPECT_GE(kSmallTooltipWidth, gfx::GetStringWidth(lines[i], font_list)); |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 TEST_F(DownloadItemModelTest, InProgressStatus) { | 278 TEST_F(DownloadItemModelTest, InProgressStatus) { |
| 279 const struct TestCase { | 279 const struct TestCase { |
| 280 int64 received_bytes; // Return value of GetReceivedBytes(). | 280 int64 received_bytes; // Return value of GetReceivedBytes(). |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 EXPECT_CALL(item(), GetAutoOpened()) | 408 EXPECT_CALL(item(), GetAutoOpened()) |
| 409 .WillRepeatedly(Return(test_case.auto_opened)); | 409 .WillRepeatedly(Return(test_case.auto_opened)); |
| 410 | 410 |
| 411 EXPECT_EQ(test_case.expected_result, | 411 EXPECT_EQ(test_case.expected_result, |
| 412 model().ShouldRemoveFromShelfWhenComplete()) | 412 model().ShouldRemoveFromShelfWhenComplete()) |
| 413 << "Test case: " << i; | 413 << "Test case: " << i; |
| 414 Mock::VerifyAndClearExpectations(&item()); | 414 Mock::VerifyAndClearExpectations(&item()); |
| 415 Mock::VerifyAndClearExpectations(&model()); | 415 Mock::VerifyAndClearExpectations(&model()); |
| 416 } | 416 } |
| 417 } | 417 } |
| OLD | NEW |