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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::string json_args_; | 151 std::string json_args_; |
152 scoped_ptr<base::Value> args_; | 152 scoped_ptr<base::Value> args_; |
153 base::Time caught_; | 153 base::Time caught_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(Event); | 155 DISALLOW_COPY_AND_ASSIGN(Event); |
156 }; | 156 }; |
157 | 157 |
158 typedef ExtensionDownloadsEventRouter::DownloadsNotificationSource | 158 typedef ExtensionDownloadsEventRouter::DownloadsNotificationSource |
159 DownloadsNotificationSource; | 159 DownloadsNotificationSource; |
160 | 160 |
161 void Observe(int type, const content::NotificationSource& source, | 161 virtual void Observe(int type, |
162 const content::NotificationDetails& details) { | 162 const content::NotificationSource& source, |
| 163 const content::NotificationDetails& details) OVERRIDE { |
163 switch (type) { | 164 switch (type) { |
164 case chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: | 165 case chrome::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: |
165 { | 166 { |
166 DownloadsNotificationSource* dns = | 167 DownloadsNotificationSource* dns = |
167 content::Source<DownloadsNotificationSource>(source).ptr(); | 168 content::Source<DownloadsNotificationSource>(source).ptr(); |
168 Event* new_event = new Event( | 169 Event* new_event = new Event( |
169 dns->profile, | 170 dns->profile, |
170 dns->event_name, | 171 dns->event_name, |
171 *content::Details<std::string>(details).ptr(), base::Time::Now()); | 172 *content::Details<std::string>(details).ptr(), base::Time::Now()); |
172 events_.push_back(new_event); | 173 events_.push_back(new_event); |
(...skipping 1955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 " \"state\": {" | 2129 " \"state\": {" |
2129 " \"previous\": \"in_progress\"," | 2130 " \"previous\": \"in_progress\"," |
2130 " \"current\": \"complete\"}}]", | 2131 " \"current\": \"complete\"}}]", |
2131 result_id, | 2132 result_id, |
2132 GetFilename("on_record.txt.crdownload").c_str(), | 2133 GetFilename("on_record.txt.crdownload").c_str(), |
2133 GetFilename("on_record.txt").c_str()))); | 2134 GetFilename("on_record.txt").c_str()))); |
2134 std::string disk_data; | 2135 std::string disk_data; |
2135 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2136 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
2136 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2137 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
2137 } | 2138 } |
OLD | NEW |