OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
915 nullptr); | 915 nullptr); |
916 | 916 |
917 EXPECT_EQ(0, observer->imageChangedCount()); | 917 EXPECT_EQ(0, observer->imageChangedCount()); |
918 | 918 |
919 imageResource->loader()->didReceiveData("notactuallyanimage", 18); | 919 imageResource->loader()->didReceiveData("notactuallyanimage", 18); |
920 | 920 |
921 EXPECT_EQ(ResourceStatus::DecodeError, imageResource->getStatus()); | 921 EXPECT_EQ(ResourceStatus::DecodeError, imageResource->getStatus()); |
922 EXPECT_TRUE(observer->imageNotifyFinishedCalled()); | 922 EXPECT_TRUE(observer->imageNotifyFinishedCalled()); |
923 EXPECT_EQ(ResourceStatus::DecodeError, | 923 EXPECT_EQ(ResourceStatus::DecodeError, |
924 observer->statusOnImageNotifyFinished()); | 924 observer->statusOnImageNotifyFinished()); |
925 EXPECT_EQ(2, observer->imageChangedCount()); | 925 EXPECT_EQ(1, observer->imageChangedCount()); |
hiroshige
2017/01/25 02:49:15
As mentioned in the design doc and CL description,
| |
926 EXPECT_FALSE(imageResource->isLoading()); | 926 EXPECT_FALSE(imageResource->isLoading()); |
927 } | 927 } |
928 | 928 |
929 TEST(ImageResourceTest, DecodeErrorWithEmptyBody) { | 929 TEST(ImageResourceTest, DecodeErrorWithEmptyBody) { |
930 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); | 930 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); |
931 ScopedRegisteredURL scopedRegisteredURL(testURL); | 931 ScopedRegisteredURL scopedRegisteredURL(testURL); |
932 | 932 |
933 ResourceFetcher* fetcher = | 933 ResourceFetcher* fetcher = |
934 ResourceFetcher::create(ImageResourceTestMockFetchContext::create()); | 934 ResourceFetcher::create(ImageResourceTestMockFetchContext::create()); |
935 FetchRequest request(testURL, FetchInitiatorInfo()); | 935 FetchRequest request(testURL, FetchInitiatorInfo()); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1125 imageResource->loader()->didReceiveResponse( | 1125 imageResource->loader()->didReceiveResponse( |
1126 WrappedResourceResponse(badResponse)); | 1126 WrappedResourceResponse(badResponse)); |
1127 | 1127 |
1128 EXPECT_EQ(0, observer->imageChangedCount()); | 1128 EXPECT_EQ(0, observer->imageChangedCount()); |
1129 | 1129 |
1130 imageResource->loader()->didReceiveData(kBadData, sizeof(kBadData)); | 1130 imageResource->loader()->didReceiveData(kBadData, sizeof(kBadData)); |
1131 | 1131 |
1132 // The dimensions could not be extracted, so the full original image should be | 1132 // The dimensions could not be extracted, so the full original image should be |
1133 // loading. | 1133 // loading. |
1134 EXPECT_FALSE(observer->imageNotifyFinishedCalled()); | 1134 EXPECT_FALSE(observer->imageNotifyFinishedCalled()); |
1135 EXPECT_EQ(3, observer->imageChangedCount()); | 1135 EXPECT_EQ(2, observer->imageChangedCount()); |
hiroshige
2017/01/25 02:49:15
ditto.
| |
1136 | 1136 |
1137 testThatReloadIsStartedAndDoReload(testURL, imageResource, | 1137 testThatReloadIsStartedAndDoReload(testURL, imageResource, |
1138 imageResource->getContent(), | 1138 imageResource->getContent(), |
1139 observer.get(), false); | 1139 observer.get(), false); |
1140 } | 1140 } |
1141 | 1141 |
1142 TEST(ImageResourceTest, FetchAllowPlaceholderPartialContentWithoutDimensions) { | 1142 TEST(ImageResourceTest, FetchAllowPlaceholderPartialContentWithoutDimensions) { |
1143 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); | 1143 KURL testURL(ParsedURLString, "http://www.test.com/cancelTest.html"); |
1144 ScopedRegisteredURL scopedRegisteredURL(testURL); | 1144 ScopedRegisteredURL scopedRegisteredURL(testURL); |
1145 | 1145 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1516 EXPECT_TRUE(observer->imageNotifyFinishedCalled()); | 1516 EXPECT_TRUE(observer->imageNotifyFinishedCalled()); |
1517 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage()); | 1517 EXPECT_TRUE(imageResource->getContent()->getImage()->isBitmapImage()); |
1518 EXPECT_EQ(50, imageResource->getContent()->getImage()->width()); | 1518 EXPECT_EQ(50, imageResource->getContent()->getImage()->width()); |
1519 EXPECT_EQ(50, imageResource->getContent()->getImage()->height()); | 1519 EXPECT_EQ(50, imageResource->getContent()->getImage()->height()); |
1520 | 1520 |
1521 WTF::setTimeFunctionsForTesting(nullptr); | 1521 WTF::setTimeFunctionsForTesting(nullptr); |
1522 } | 1522 } |
1523 | 1523 |
1524 } // namespace | 1524 } // namespace |
1525 } // namespace blink | 1525 } // namespace blink |
OLD | NEW |