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

Unified Diff: ppapi/proxy/file_chooser_resource_unittest.cc

Issue 21966004: Pepper: Move FileRef to the "new" resource proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove code duplication Created 7 years, 4 months 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: ppapi/proxy/file_chooser_resource_unittest.cc
diff --git a/ppapi/proxy/file_chooser_resource_unittest.cc b/ppapi/proxy/file_chooser_resource_unittest.cc
index a5801eed161c00a9055c220832fc529aee08d9b3..2c44336b5dbad6f65192331191c8b46ddf3b3fbf 100644
--- a/ppapi/proxy/file_chooser_resource_unittest.cc
+++ b/ppapi/proxy/file_chooser_resource_unittest.cc
@@ -5,6 +5,7 @@
#include "base/message_loop/message_loop.h"
#include "ppapi/c/dev/ppb_file_chooser_dev.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_file_ref.h"
#include "ppapi/proxy/file_chooser_resource.h"
#include "ppapi/proxy/locking_resource_releaser.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -93,11 +94,13 @@ TEST_F(FileChooserResourceTest, Show) {
// Synthesize a response with one file ref in it. Note that it must have a
// host resource value set or deserialization will fail. Since there isn't
// actually a host, this can be whatever we want.
- std::vector<PPB_FileRef_CreateInfo> create_info_array;
- PPB_FileRef_CreateInfo create_info;
- create_info.resource.SetHostResource(pp_instance(), 123);
- create_info.path = "foo/bar";
- create_info.name = "baz";
+ std::vector<FileRef_CreateInfo> create_info_array;
+ FileRef_CreateInfo create_info;
+ // In practice, we would be dealing with files on an external filesystem, but
+ // plugins aren't allowed to create resources there, so we use LOCALTEMPORARY
+ // here instead.
+ create_info.file_system_type = PP_FILESYSTEMTYPE_LOCALTEMPORARY;
dmichael (off chromium) 2013/08/07 22:19:13 I'm not sure I understand why you need to do this.
teravest 2013/08/08 00:50:06 The problem is that an external FileRef always nee
dmichael (off chromium) 2013/08/08 21:24:03 Hmm. It feels quite weird to unit test a file type
+ create_info.internal_path = "/foo/bar";
create_info_array.push_back(create_info);
ASSERT_TRUE(plugin_dispatcher()->OnMessageReceived(
PpapiPluginMsg_ResourceReply(reply_params,
@@ -108,21 +111,20 @@ TEST_F(FileChooserResourceTest, Show) {
LockingResourceReleaser dest_deletor(dest[0]); // Ensure it's cleaned up.
const PPB_FileRef_1_0* file_ref_iface = thunk::GetPPB_FileRef_1_0_Thunk();
- EXPECT_EQ(PP_FILESYSTEMTYPE_EXTERNAL,
+ EXPECT_EQ(PP_FILESYSTEMTYPE_LOCALTEMPORARY,
file_ref_iface->GetFileSystemType(dest[0]));
PP_Var name_var(file_ref_iface->GetName(dest[0]));
{
ProxyAutoLock lock;
ScopedPPVar release_name_var(ScopedPPVar::PassRef(), name_var);
- EXPECT_VAR_IS_STRING(create_info.name, name_var);
+ EXPECT_VAR_IS_STRING("bar", name_var);
}
- // Path should be undefined since it's external filesystem.
PP_Var path_var(file_ref_iface->GetPath(dest[0]));
{
ProxyAutoLock lock;
ScopedPPVar release_path_var(ScopedPPVar::PassRef(), path_var);
- EXPECT_EQ(PP_VARTYPE_UNDEFINED, path_var.type);
+ EXPECT_VAR_IS_STRING(create_info.internal_path, path_var);
}
}

Powered by Google App Engine
This is Rietveld 408576698