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

Side by Side Diff: chrome/browser/performance_monitor/performance_monitor_browsertest.cc

Issue 10694056: CPM Extension Uninstall Watching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 5 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 #include "chrome/test/base/in_process_browser_test.h" 5 #include "chrome/test/base/in_process_browser_test.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 std::vector<linked_ptr<Event> > events = GetEvents(); 317 std::vector<linked_ptr<Event> > events = GetEvents();
318 318
319 CheckExtensionEvents(expected_event_types, events, extension_infos); 319 CheckExtensionEvents(expected_event_types, events, extension_infos);
320 320
321 // There will be an additional field: The unload reason. 321 // There will be an additional field: The unload reason.
322 int unload_reason = -1; 322 int unload_reason = -1;
323 ASSERT_TRUE(events[2]->data()->GetInteger("unloadReason", &unload_reason)); 323 ASSERT_TRUE(events[2]->data()->GetInteger("unloadReason", &unload_reason));
324 ASSERT_EQ(extension_misc::UNLOAD_REASON_UPDATE, unload_reason); 324 ASSERT_EQ(extension_misc::UNLOAD_REASON_UPDATE, unload_reason);
325 } 325 }
326 326
327 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, UninstallExtensionEvent) {
328 const int kNumEvents = 3;
329 FilePath extension_path;
330 PathService::Get(chrome::DIR_TEST_DATA, &extension_path);
331 extension_path = extension_path.AppendASCII("performance_monitor")
332 .AppendASCII("extensions")
333 .AppendASCII("simple_extension_v1");
334 const Extension* extension = LoadExtension(extension_path);
335
336 std::vector<ExtensionBasicInfo> extension_infos;
337 // There will be three events in all, each pertaining to the same extension:
338 // Extension Install
339 // Extension Disable (Unload)
340 // Extension Uninstall
341 for (int i = 0; i < kNumEvents; ++i)
342 extension_infos.push_back(ExtensionBasicInfo(extension));
343
344 UninstallExtension(extension->id());
345
346 std::vector<int> expected_event_types;
347 expected_event_types.push_back(EVENT_EXTENSION_INSTALL);
348 expected_event_types.push_back(EVENT_EXTENSION_UNLOAD);
349 expected_event_types.push_back(EVENT_EXTENSION_UNINSTALL);
350
351 std::vector<linked_ptr<Event> > events = GetEvents();
352
353 CheckExtensionEvents(expected_event_types, events, extension_infos);
354
355 // There will be an additional field: The unload reason.
356 int unload_reason = -1;
357 ASSERT_TRUE(events[1]->data()->GetInteger("unloadReason", &unload_reason));
358 ASSERT_EQ(extension_misc::UNLOAD_REASON_UNINSTALL, unload_reason);
359 }
360
327 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, NewVersionEvent) { 361 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, NewVersionEvent) {
328 const char kOldVersion[] = "0.0"; 362 const char kOldVersion[] = "0.0";
329 363
330 // The version in the database right now will be the current version of chrome 364 // The version in the database right now will be the current version of chrome
331 // (gathered at initialization of PerformanceMonitor). Replace this with an 365 // (gathered at initialization of PerformanceMonitor). Replace this with an
332 // older version so an event is generated. 366 // older version so an event is generated.
333 AddStateValue(kStateChromeVersion, kOldVersion); 367 AddStateValue(kStateChromeVersion, kOldVersion);
334 368
335 content::BrowserThread::PostBlockingPoolSequencedTask( 369 content::BrowserThread::PostBlockingPoolSequencedTask(
336 Database::kDatabaseSequenceToken, 370 Database::kDatabaseSequenceToken,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, RendererCrashEvent) { 413 IN_PROC_BROWSER_TEST_F(PerformanceMonitorBrowserTest, RendererCrashEvent) {
380 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL)); 414 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUICrashURL));
381 415
382 std::vector<linked_ptr<Event> > events = GetEvents(); 416 std::vector<linked_ptr<Event> > events = GetEvents();
383 ASSERT_EQ(1u, events.size()); 417 ASSERT_EQ(1u, events.size());
384 418
385 CheckEventType(EVENT_RENDERER_CRASH, events[0]); 419 CheckEventType(EVENT_RENDERER_CRASH, events[0]);
386 } 420 }
387 421
388 } // namespace performance_monitor 422 } // namespace performance_monitor
OLDNEW
« no previous file with comments | « chrome/browser/performance_monitor/performance_monitor.cc ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698