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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_log_unittest.cc

Issue 2372223003: [Extensions] Fix incorrect counting prefs in activity log (Closed)
Patch Set: nit Created 4 years, 2 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
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser/extensions/activity_log/activity_log.h" 5 #include "chrome/browser/extensions/activity_log/activity_log.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 423 }
424 424
425 class ActivityLogTestWithoutSwitch : public ActivityLogTest { 425 class ActivityLogTestWithoutSwitch : public ActivityLogTest {
426 public: 426 public:
427 ActivityLogTestWithoutSwitch() {} 427 ActivityLogTestWithoutSwitch() {}
428 ~ActivityLogTestWithoutSwitch() override {} 428 ~ActivityLogTestWithoutSwitch() override {}
429 bool enable_activity_logging_switch() const override { return false; } 429 bool enable_activity_logging_switch() const override { return false; }
430 }; 430 };
431 431
432 TEST_F(ActivityLogTestWithoutSwitch, TestShouldLog) { 432 TEST_F(ActivityLogTestWithoutSwitch, TestShouldLog) {
433 static_cast<TestExtensionSystem*>(
434 ExtensionSystem::Get(profile()))->SetReady();
433 ActivityLog* activity_log = ActivityLog::GetInstance(profile()); 435 ActivityLog* activity_log = ActivityLog::GetInstance(profile());
434 scoped_refptr<const Extension> empty_extension = 436 scoped_refptr<const Extension> empty_extension =
435 test_util::CreateEmptyExtension(); 437 test_util::CreateEmptyExtension();
436 extension_service_->AddExtension(empty_extension.get()); 438 extension_service_->AddExtension(empty_extension.get());
437 // Since the command line switch for logging isn't enabled and there's no 439 // Since the command line switch for logging isn't enabled and there's no
438 // watchdog app active, the activity log shouldn't log anything. 440 // watchdog app active, the activity log shouldn't log anything.
439 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id())); 441 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id()));
440 const char kWhitelistedExtensionId[] = "eplckmlabaanikjjcgnigddmagoglhmp"; 442 const char kWhitelistedExtensionId[] = "eplckmlabaanikjjcgnigddmagoglhmp";
441 scoped_refptr<const Extension> activity_log_extension = 443 scoped_refptr<const Extension> activity_log_extension =
442 test_util::CreateEmptyExtension(kWhitelistedExtensionId); 444 test_util::CreateEmptyExtension(kWhitelistedExtensionId);
443 extension_service_->AddExtension(activity_log_extension.get()); 445 extension_service_->AddExtension(activity_log_extension.get());
444 // Loading a watchdog app means the activity log should log other extension 446 // Loading a watchdog app means the activity log should log other extension
445 // activities... 447 // activities...
446 EXPECT_TRUE(activity_log->ShouldLog(empty_extension->id())); 448 EXPECT_TRUE(activity_log->ShouldLog(empty_extension->id()));
447 // ... but not those of the watchdog app. 449 // ... but not those of the watchdog app.
448 EXPECT_FALSE(activity_log->ShouldLog(activity_log_extension->id())); 450 EXPECT_FALSE(activity_log->ShouldLog(activity_log_extension->id()));
449 extension_service_->DisableExtension(activity_log_extension->id(), 451 extension_service_->DisableExtension(activity_log_extension->id(),
450 Extension::DISABLE_USER_ACTION); 452 Extension::DISABLE_USER_ACTION);
451 // Disabling the watchdog app means that we're back to never logging anything. 453 // Disabling the watchdog app means that we're back to never logging anything.
452 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id())); 454 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id()));
453 } 455 }
454 456
455 } // namespace extensions 457 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698