OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/fileapi/fileapi_message_filter.h" | 5 #include "content/browser/fileapi/fileapi_message_filter.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const GURL kUrl("blob:foobar"); | 60 const GURL kUrl("blob:foobar"); |
61 const GURL kDifferentUrl("blob:barfoo"); | 61 const GURL kDifferentUrl("blob:barfoo"); |
62 const std::string kContentType = "fake/type"; | 62 const std::string kContentType = "fake/type"; |
63 | 63 |
64 EXPECT_EQ(NULL, controller->GetBlobDataFromUrl(kUrl)); | 64 EXPECT_EQ(NULL, controller->GetBlobDataFromUrl(kUrl)); |
65 | 65 |
66 // Test via OnMessageReceived(const IPC::Message&) which is called by the | 66 // Test via OnMessageReceived(const IPC::Message&) which is called by the |
67 // channel proxy. Since OnMessageReceived is hidden on FileAPIMessageFilter, | 67 // channel proxy. Since OnMessageReceived is hidden on FileAPIMessageFilter, |
68 // cast it. | 68 // cast it. |
69 IPC::ChannelProxy::MessageFilter* casted_filter = | 69 IPC::ChannelProxy::MessageFilter* casted_filter = |
70 static_cast<IPC::ChannelProxy::MessageFilter*>(filter); | 70 static_cast<IPC::ChannelProxy::MessageFilter*>(filter.get()); |
71 | 71 |
72 BlobHostMsg_StartBuildingBlob start_message(kUrl); | 72 BlobHostMsg_StartBuildingBlob start_message(kUrl); |
73 EXPECT_TRUE(casted_filter->OnMessageReceived(start_message)); | 73 EXPECT_TRUE(casted_filter->OnMessageReceived(start_message)); |
74 | 74 |
75 // Blob is still being built. Nothing should be returned. | 75 // Blob is still being built. Nothing should be returned. |
76 EXPECT_EQ(NULL, controller->GetBlobDataFromUrl(kUrl)); | 76 EXPECT_EQ(NULL, controller->GetBlobDataFromUrl(kUrl)); |
77 | 77 |
78 BlobHostMsg_FinishBuildingBlob finish_message(kUrl, kContentType); | 78 BlobHostMsg_FinishBuildingBlob finish_message(kUrl, kContentType); |
79 EXPECT_TRUE(casted_filter->OnMessageReceived(finish_message)); | 79 EXPECT_TRUE(casted_filter->OnMessageReceived(finish_message)); |
80 | 80 |
81 // Now, Blob is built. | 81 // Now, Blob is built. |
82 webkit_blob::BlobData* blob_data = controller->GetBlobDataFromUrl(kUrl); | 82 webkit_blob::BlobData* blob_data = controller->GetBlobDataFromUrl(kUrl); |
83 ASSERT_FALSE(blob_data == NULL); | 83 ASSERT_FALSE(blob_data == NULL); |
84 EXPECT_EQ(0U, blob_data->items().size()); | 84 EXPECT_EQ(0U, blob_data->items().size()); |
85 EXPECT_EQ(kContentType, blob_data->content_type()); | 85 EXPECT_EQ(kContentType, blob_data->content_type()); |
86 | 86 |
87 // Nothing should be returned for a URL we didn't use. | 87 // Nothing should be returned for a URL we didn't use. |
88 EXPECT_TRUE(controller->GetBlobDataFromUrl(kDifferentUrl) == NULL); | 88 EXPECT_TRUE(controller->GetBlobDataFromUrl(kDifferentUrl) == NULL); |
89 } | 89 } |
90 | 90 |
91 } // namespace fileapi | 91 } // namespace fileapi |
OLD | NEW |