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

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

Issue 2980503002: [Extensions][TaskScheduler] Update ActivityLog for scheduling migration (Closed)
Patch Set: Experiments Created 3 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/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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "chrome/browser/extensions/activity_log/activity_action_constants.h" 17 #include "chrome/browser/extensions/activity_log/activity_action_constants.h"
18 #include "chrome/browser/extensions/activity_log/activity_log_task_runner.h"
18 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
19 #include "chrome/browser/extensions/test_extension_system.h" 20 #include "chrome/browser/extensions/test_extension_system.h"
20 #include "chrome/browser/prerender/prerender_handle.h" 21 #include "chrome/browser/prerender/prerender_handle.h"
21 #include "chrome/browser/prerender/prerender_manager.h" 22 #include "chrome/browser/prerender/prerender_manager.h"
22 #include "chrome/browser/prerender/prerender_manager_factory.h" 23 #include "chrome/browser/prerender/prerender_manager_factory.h"
23 #include "chrome/common/chrome_constants.h" 24 #include "chrome/common/chrome_constants.h"
24 #include "chrome/common/chrome_switches.h" 25 #include "chrome/common/chrome_switches.h"
25 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 26 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
26 #include "chrome/test/base/testing_profile.h" 27 #include "chrome/test/base/testing_profile.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
(...skipping 19 matching lines...) Expand all
47 "HTMLMediaElement.src", "HTMLMediaElement.currentSrc", 48 "HTMLMediaElement.src", "HTMLMediaElement.currentSrc",
48 "HTMLModElement.cite", "HTMLObjectElement.data", 49 "HTMLModElement.cite", "HTMLObjectElement.data",
49 "HTMLQuoteElement.cite", "HTMLScriptElement.src", 50 "HTMLQuoteElement.cite", "HTMLScriptElement.src",
50 "HTMLSourceElement.src", "HTMLTrackElement.src", 51 "HTMLSourceElement.src", "HTMLTrackElement.src",
51 "HTMLVideoElement.poster"}; 52 "HTMLVideoElement.poster"};
52 53
53 } // namespace 54 } // namespace
54 55
55 namespace extensions { 56 namespace extensions {
56 57
57 class ActivityLogTest : public ChromeRenderViewHostTestHarness { 58 class ActivityLogTest : public ChromeRenderViewHostTestHarness {
Devlin 2017/07/12 19:30:37 Interestingly, these tests are still failing with
58 protected: 59 protected:
59 virtual bool enable_activity_logging_switch() const { return true; } 60 virtual bool enable_activity_logging_switch() const { return true; }
60 void SetUp() override { 61 void SetUp() override {
61 ChromeRenderViewHostTestHarness::SetUp(); 62 ChromeRenderViewHostTestHarness::SetUp();
63
62 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); 64 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
63 if (enable_activity_logging_switch()) { 65 if (enable_activity_logging_switch()) {
64 base::CommandLine::ForCurrentProcess()->AppendSwitch( 66 base::CommandLine::ForCurrentProcess()->AppendSwitch(
65 switches::kEnableExtensionActivityLogging); 67 switches::kEnableExtensionActivityLogging);
66 } 68 }
67 base::CommandLine::ForCurrentProcess()->AppendSwitch( 69 base::CommandLine::ForCurrentProcess()->AppendSwitch(
68 switches::kEnableExtensionActivityLogTesting); 70 switches::kEnableExtensionActivityLogTesting);
69 extension_service_ = static_cast<TestExtensionSystem*>( 71 extension_service_ = static_cast<TestExtensionSystem*>(
70 ExtensionSystem::Get(profile()))->CreateExtensionService 72 ExtensionSystem::Get(profile()))->CreateExtensionService
71 (&command_line, base::FilePath(), false); 73 (&command_line, base::FilePath(), false);
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 EXPECT_TRUE(activity_log->ShouldLog(empty_extension->id())); 431 EXPECT_TRUE(activity_log->ShouldLog(empty_extension->id()));
430 // ... but not those of the watchdog app. 432 // ... but not those of the watchdog app.
431 EXPECT_FALSE(activity_log->ShouldLog(activity_log_extension->id())); 433 EXPECT_FALSE(activity_log->ShouldLog(activity_log_extension->id()));
432 extension_service_->DisableExtension(activity_log_extension->id(), 434 extension_service_->DisableExtension(activity_log_extension->id(),
433 Extension::DISABLE_USER_ACTION); 435 Extension::DISABLE_USER_ACTION);
434 // Disabling the watchdog app means that we're back to never logging anything. 436 // Disabling the watchdog app means that we're back to never logging anything.
435 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id())); 437 EXPECT_FALSE(activity_log->ShouldLog(empty_extension->id()));
436 } 438 }
437 439
438 } // namespace extensions 440 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698