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

Side by Side Diff: chrome/browser/extensions/api/management/management_browsertest.cc

Issue 2858073002: Use constexpr TaskTraits constructor in chrome. (Closed)
Patch Set: Created 3 years, 7 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 // Tests extension autoupdate. 289 // Tests extension autoupdate.
290 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) { 290 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, MAYBE_AutoUpdate) {
291 NotificationListener notification_listener; 291 NotificationListener notification_listener;
292 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 292 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
293 293
294 // Note: This interceptor gets requests on the IO thread. 294 // Note: This interceptor gets requests on the IO thread.
295 net::LocalHostTestURLRequestInterceptor interceptor( 295 net::LocalHostTestURLRequestInterceptor interceptor(
296 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 296 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
297 base::CreateTaskRunnerWithTraits( 297 base::CreateTaskRunnerWithTraits(
298 base::TaskTraits() 298 {base::MayBlock(), base::TaskPriority::BACKGROUND,
299 .MayBlock() 299 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
300 .WithPriority(base::TaskPriority::BACKGROUND)
301 .WithShutdownBehavior(
302 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
303 300
304 interceptor.SetResponseIgnoreQuery( 301 interceptor.SetResponseIgnoreQuery(
305 GURL("http://localhost/autoupdate/manifest"), 302 GURL("http://localhost/autoupdate/manifest"),
306 basedir.AppendASCII("manifest_v2.xml")); 303 basedir.AppendASCII("manifest_v2.xml"));
307 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), 304 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
308 basedir.AppendASCII("v2.crx")); 305 basedir.AppendASCII("v2.crx"));
309 306
310 // Install version 1 of the extension. 307 // Install version 1 of the extension.
311 ExtensionTestMessageListener listener1("v1 installed", false); 308 ExtensionTestMessageListener listener1("v1 installed", false);
312 ExtensionService* service = extensions::ExtensionSystem::Get( 309 ExtensionService* service = extensions::ExtensionSystem::Get(
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 // Tests extension autoupdate. 379 // Tests extension autoupdate.
383 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest, 380 IN_PROC_BROWSER_TEST_F(ExtensionManagementTest,
384 MAYBE_AutoUpdateDisabledExtensions) { 381 MAYBE_AutoUpdateDisabledExtensions) {
385 NotificationListener notification_listener; 382 NotificationListener notification_listener;
386 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 383 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
387 384
388 // Note: This interceptor gets requests on the IO thread. 385 // Note: This interceptor gets requests on the IO thread.
389 net::LocalHostTestURLRequestInterceptor interceptor( 386 net::LocalHostTestURLRequestInterceptor interceptor(
390 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 387 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
391 base::CreateTaskRunnerWithTraits( 388 base::CreateTaskRunnerWithTraits(
392 base::TaskTraits() 389 {base::MayBlock(), base::TaskPriority::BACKGROUND,
393 .MayBlock() 390 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
394 .WithPriority(base::TaskPriority::BACKGROUND)
395 .WithShutdownBehavior(
396 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
397 391
398 interceptor.SetResponseIgnoreQuery( 392 interceptor.SetResponseIgnoreQuery(
399 GURL("http://localhost/autoupdate/manifest"), 393 GURL("http://localhost/autoupdate/manifest"),
400 basedir.AppendASCII("manifest_v2.xml")); 394 basedir.AppendASCII("manifest_v2.xml"));
401 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), 395 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
402 basedir.AppendASCII("v2.crx")); 396 basedir.AppendASCII("v2.crx"));
403 397
404 // Install version 1 of the extension. 398 // Install version 1 of the extension.
405 ExtensionTestMessageListener listener1("v1 installed", false); 399 ExtensionTestMessageListener listener1("v1 installed", false);
406 ExtensionService* service = extensions::ExtensionSystem::Get( 400 ExtensionService* service = extensions::ExtensionSystem::Get(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 browser()->profile())->extension_service(); 449 browser()->profile())->extension_service();
456 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; 450 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
457 extensions::ExtensionUpdater::CheckParams params; 451 extensions::ExtensionUpdater::CheckParams params;
458 452
459 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 453 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
460 454
461 // Note: This interceptor gets requests on the IO thread. 455 // Note: This interceptor gets requests on the IO thread.
462 net::LocalHostTestURLRequestInterceptor interceptor( 456 net::LocalHostTestURLRequestInterceptor interceptor(
463 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 457 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
464 base::CreateTaskRunnerWithTraits( 458 base::CreateTaskRunnerWithTraits(
465 base::TaskTraits() 459 {base::MayBlock(), base::TaskPriority::BACKGROUND,
466 .MayBlock() 460 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
467 .WithPriority(base::TaskPriority::BACKGROUND)
468 .WithShutdownBehavior(
469 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
470 461
471 interceptor.SetResponseIgnoreQuery( 462 interceptor.SetResponseIgnoreQuery(
472 GURL("http://localhost/autoupdate/manifest"), 463 GURL("http://localhost/autoupdate/manifest"),
473 basedir.AppendASCII("manifest_v2.xml")); 464 basedir.AppendASCII("manifest_v2.xml"));
474 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), 465 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
475 basedir.AppendASCII("v2.crx")); 466 basedir.AppendASCII("v2.crx"));
476 467
477 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); 468 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
478 const size_t size_before = registry->enabled_extensions().size(); 469 const size_t size_before = registry->enabled_extensions().size();
479 ASSERT_TRUE(registry->disabled_extensions().is_empty()); 470 ASSERT_TRUE(registry->disabled_extensions().is_empty());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 ExtensionService* service = extensions::ExtensionSystem::Get( 546 ExtensionService* service = extensions::ExtensionSystem::Get(
556 browser()->profile())->extension_service(); 547 browser()->profile())->extension_service();
557 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; 548 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
558 549
559 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 550 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
560 551
561 // Note: This interceptor gets requests on the IO thread. 552 // Note: This interceptor gets requests on the IO thread.
562 net::LocalHostTestURLRequestInterceptor interceptor( 553 net::LocalHostTestURLRequestInterceptor interceptor(
563 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 554 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
564 base::CreateTaskRunnerWithTraits( 555 base::CreateTaskRunnerWithTraits(
565 base::TaskTraits() 556 {base::MayBlock(), base::TaskPriority::BACKGROUND,
566 .MayBlock() 557 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
567 .WithPriority(base::TaskPriority::BACKGROUND)
568 .WithShutdownBehavior(
569 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
570 558
571 interceptor.SetResponseIgnoreQuery( 559 interceptor.SetResponseIgnoreQuery(
572 GURL("http://localhost/autoupdate/manifest"), 560 GURL("http://localhost/autoupdate/manifest"),
573 basedir.AppendASCII("manifest_v2.xml")); 561 basedir.AppendASCII("manifest_v2.xml"));
574 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), 562 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
575 basedir.AppendASCII("v2.crx")); 563 basedir.AppendASCII("v2.crx"));
576 564
577 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); 565 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
578 const size_t size_before = registry->enabled_extensions().size(); 566 const size_t size_before = registry->enabled_extensions().size();
579 ASSERT_TRUE(registry->disabled_extensions().is_empty()); 567 ASSERT_TRUE(registry->disabled_extensions().is_empty());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile()); 628 ExtensionRegistry* registry = ExtensionRegistry::Get(browser()->profile());
641 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf"; 629 const char kExtensionId[] = "ogjcoiohnmldgjemafoockdghcjciccf";
642 const size_t size_before = registry->enabled_extensions().size(); 630 const size_t size_before = registry->enabled_extensions().size();
643 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate"); 631 base::FilePath basedir = test_data_dir_.AppendASCII("autoupdate");
644 ASSERT_TRUE(registry->disabled_extensions().is_empty()); 632 ASSERT_TRUE(registry->disabled_extensions().is_empty());
645 633
646 // Note: This interceptor gets requests on the IO thread. 634 // Note: This interceptor gets requests on the IO thread.
647 net::LocalHostTestURLRequestInterceptor interceptor( 635 net::LocalHostTestURLRequestInterceptor interceptor(
648 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 636 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
649 base::CreateTaskRunnerWithTraits( 637 base::CreateTaskRunnerWithTraits(
650 base::TaskTraits() 638 {base::MayBlock(), base::TaskPriority::BACKGROUND,
651 .MayBlock() 639 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
652 .WithPriority(base::TaskPriority::BACKGROUND)
653 .WithShutdownBehavior(
654 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN)));
655 640
656 interceptor.SetResponseIgnoreQuery( 641 interceptor.SetResponseIgnoreQuery(
657 GURL("http://localhost/autoupdate/manifest"), 642 GURL("http://localhost/autoupdate/manifest"),
658 basedir.AppendASCII("manifest_v2.xml")); 643 basedir.AppendASCII("manifest_v2.xml"));
659 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"), 644 interceptor.SetResponseIgnoreQuery(GURL("http://localhost/autoupdate/v2.crx"),
660 basedir.AppendASCII("v2.crx")); 645 basedir.AppendASCII("v2.crx"));
661 646
662 // Check that the policy is initially empty. 647 // Check that the policy is initially empty.
663 ASSERT_TRUE(extensions::ExtensionManagementFactory::GetForBrowserContext( 648 ASSERT_TRUE(extensions::ExtensionManagementFactory::GetForBrowserContext(
664 browser()->profile()) 649 browser()->profile())
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 UpdateProviderPolicy(policies); 714 UpdateProviderPolicy(policies);
730 extension_observer.WaitForExtensionWillBeInstalled(); 715 extension_observer.WaitForExtensionWillBeInstalled();
731 716
732 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size()); 717 ASSERT_EQ(size_before + 1, registry->enabled_extensions().size());
733 extension = service->GetExtensionById(kExtensionId, false); 718 extension = service->GetExtensionById(kExtensionId, false);
734 ASSERT_TRUE(extension); 719 ASSERT_TRUE(extension);
735 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 720 EXPECT_EQ(Manifest::EXTERNAL_POLICY_DOWNLOAD, extension->location());
736 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 721 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
737 EXPECT_TRUE(registry->disabled_extensions().is_empty()); 722 EXPECT_TRUE(registry->disabled_extensions().is_empty());
738 } 723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698