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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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 unified diff | Download patch
OLDNEW
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 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 DownloadsNotificationSource; 171 DownloadsNotificationSource;
172 172
173 void Observe(int type, 173 void Observe(int type,
174 const content::NotificationSource& source, 174 const content::NotificationSource& source,
175 const content::NotificationDetails& details) override { 175 const content::NotificationDetails& details) override {
176 switch (type) { 176 switch (type) {
177 case extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: { 177 case extensions::NOTIFICATION_EXTENSION_DOWNLOADS_EVENT: {
178 DownloadsNotificationSource* dns = 178 DownloadsNotificationSource* dns =
179 content::Source<DownloadsNotificationSource>(source).ptr(); 179 content::Source<DownloadsNotificationSource>(source).ptr();
180 Event* new_event = new Event( 180 Event* new_event = new Event(
181 dns->profile, 181 dns->profile, dns->event_name,
182 dns->event_name,
183 *content::Details<std::string>(details).ptr(), base::Time::Now()); 182 *content::Details<std::string>(details).ptr(), base::Time::Now());
184 events_.push_back(new_event); 183 events_.push_back(new_event);
185 if (waiting_ && 184 if (waiting_ &&
186 waiting_for_.get() && 185 waiting_for_.get() &&
187 new_event->Satisfies(*waiting_for_)) { 186 new_event->Satisfies(*waiting_for_)) {
188 waiting_ = false; 187 waiting_ = false;
189 base::MessageLoopForUI::current()->Quit(); 188 base::MessageLoopForUI::current()->Quit();
190 } 189 }
191 break; 190 break;
192 } 191 }
(...skipping 3955 matching lines...) Expand 10 before | Expand all | Expand 10 after
4148 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 4147 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
4149 EXPECT_FALSE(warnings.empty()); 4148 EXPECT_FALSE(warnings.empty());
4150 EXPECT_EQ(Warning::kDownloadFilenameConflict, 4149 EXPECT_EQ(Warning::kDownloadFilenameConflict,
4151 warnings.begin()->warning_type()); 4150 warnings.begin()->warning_type());
4152 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 4151 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
4153 } 4152 }
4154 4153
4155 } // namespace extensions 4154 } // namespace extensions
4156 4155
4157 #endif // http://crbug.com/3061144 4156 #endif // http://crbug.com/3061144
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698