OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 base::Unretained(&dispatcher))); | 100 base::Unretained(&dispatcher))); |
101 | 101 |
102 EXPECT_TRUE(unmount.Execute(kRequestId)); | 102 EXPECT_TRUE(unmount.Execute(kRequestId)); |
103 | 103 |
104 ASSERT_EQ(1u, dispatcher.events().size()); | 104 ASSERT_EQ(1u, dispatcher.events().size()); |
105 extensions::Event* event = dispatcher.events()[0]; | 105 extensions::Event* event = dispatcher.events()[0]; |
106 EXPECT_EQ( | 106 EXPECT_EQ( |
107 extensions::api::file_system_provider::OnUnmountRequested::kEventName, | 107 extensions::api::file_system_provider::OnUnmountRequested::kEventName, |
108 event->event_name); | 108 event->event_name); |
109 base::ListValue* event_args = event->event_args.get(); | 109 base::ListValue* event_args = event->event_args.get(); |
110 ASSERT_EQ(2u, event_args->GetSize()); | 110 ASSERT_EQ(1u, event_args->GetSize()); |
| 111 |
| 112 base::DictionaryValue* options = NULL; |
| 113 ASSERT_TRUE(event_args->GetDictionary(0, &options)); |
111 | 114 |
112 std::string event_file_system_id; | 115 std::string event_file_system_id; |
113 EXPECT_TRUE(event_args->GetString(0, &event_file_system_id)); | 116 EXPECT_TRUE(options->GetString("fileSystemId", &event_file_system_id)); |
114 EXPECT_EQ(kFileSystemId, event_file_system_id); | 117 EXPECT_EQ(kFileSystemId, event_file_system_id); |
115 | 118 |
116 int event_request_id = -1; | 119 int event_request_id = -1; |
117 EXPECT_TRUE(event_args->GetInteger(1, &event_request_id)); | 120 EXPECT_TRUE(options->GetInteger("requestId", &event_request_id)); |
118 EXPECT_EQ(kRequestId, event_request_id); | 121 EXPECT_EQ(kRequestId, event_request_id); |
119 } | 122 } |
120 | 123 |
121 TEST_F(FileSystemProviderOperationsUnmountTest, Execute_NoListener) { | 124 TEST_F(FileSystemProviderOperationsUnmountTest, Execute_NoListener) { |
122 LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); | 125 LoggingDispatchEventImpl dispatcher(false /* dispatch_reply */); |
123 CallbackLogger callback_logger; | 126 CallbackLogger callback_logger; |
124 | 127 |
125 Unmount unmount( | 128 Unmount unmount( |
126 NULL, | 129 NULL, |
127 file_system_info_, | 130 file_system_info_, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 180 |
178 unmount.OnError(kRequestId, base::File::FILE_ERROR_NOT_FOUND); | 181 unmount.OnError(kRequestId, base::File::FILE_ERROR_NOT_FOUND); |
179 ASSERT_EQ(1u, callback_logger.events().size()); | 182 ASSERT_EQ(1u, callback_logger.events().size()); |
180 base::File::Error event_result = callback_logger.events()[0]; | 183 base::File::Error event_result = callback_logger.events()[0]; |
181 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result); | 184 EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, event_result); |
182 } | 185 } |
183 | 186 |
184 } // namespace operations | 187 } // namespace operations |
185 } // namespace file_system_provider | 188 } // namespace file_system_provider |
186 } // namespace chromeos | 189 } // namespace chromeos |
OLD | NEW |