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

Side by Side Diff: chrome/browser/browsing_data/chrome_browsing_data_remover_delegate_unittest.cc

Issue 2842833003: Update SupportsUserData uses with unique_ptr. (Closed)
Patch Set: rebase 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/browsing_data/chrome_browsing_data_remover_delegate.h" 5 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 private: 521 private:
522 void AttachService() { 522 void AttachService() {
523 const void* kKey = TestingDomainReliabilityServiceFactoryUserData::kKey; 523 const void* kKey = TestingDomainReliabilityServiceFactoryUserData::kKey;
524 524
525 // Attach kludgey UserData struct to profile. 525 // Attach kludgey UserData struct to profile.
526 TestingDomainReliabilityServiceFactoryUserData* data = 526 TestingDomainReliabilityServiceFactoryUserData* data =
527 new TestingDomainReliabilityServiceFactoryUserData(profile_, 527 new TestingDomainReliabilityServiceFactoryUserData(profile_,
528 mock_service_); 528 mock_service_);
529 EXPECT_FALSE(profile_->GetUserData(kKey)); 529 EXPECT_FALSE(profile_->GetUserData(kKey));
530 profile_->SetUserData(kKey, data); 530 profile_->SetUserData(kKey, base::WrapUnique(data));
531 531
532 // Set and use factory that will attach service stuffed in kludgey struct. 532 // Set and use factory that will attach service stuffed in kludgey struct.
533 DomainReliabilityServiceFactory::GetInstance()->SetTestingFactoryAndUse( 533 DomainReliabilityServiceFactory::GetInstance()->SetTestingFactoryAndUse(
534 profile_, 534 profile_,
535 &TestingDomainReliabilityServiceFactoryFunction); 535 &TestingDomainReliabilityServiceFactoryFunction);
536 536
537 // Verify and detach kludgey struct. 537 // Verify and detach kludgey struct.
538 EXPECT_EQ(data, profile_->GetUserData(kKey)); 538 EXPECT_EQ(data, profile_->GetUserData(kKey));
539 EXPECT_TRUE(data->attached); 539 EXPECT_TRUE(data->attached);
540 profile_->RemoveUserData(kKey); 540 profile_->RemoveUserData(kKey);
(...skipping 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 EXPECT_FALSE(Match(kOrigin1, kProtected, nullptr)); 2013 EXPECT_FALSE(Match(kOrigin1, kProtected, nullptr));
2014 EXPECT_FALSE(Match(kOriginExt, kProtected, nullptr)); 2014 EXPECT_FALSE(Match(kOriginExt, kProtected, nullptr));
2015 EXPECT_FALSE(Match(kOriginDevTools, kProtected, nullptr)); 2015 EXPECT_FALSE(Match(kOriginDevTools, kProtected, nullptr));
2016 2016
2017 #if BUILDFLAG(ENABLE_EXTENSIONS) 2017 #if BUILDFLAG(ENABLE_EXTENSIONS)
2018 EXPECT_FALSE(Match(kOrigin1, kExtension, nullptr)); 2018 EXPECT_FALSE(Match(kOrigin1, kExtension, nullptr));
2019 EXPECT_TRUE(Match(kOriginExt, kExtension, nullptr)); 2019 EXPECT_TRUE(Match(kOriginExt, kExtension, nullptr));
2020 EXPECT_FALSE(Match(kOriginDevTools, kExtension, nullptr)); 2020 EXPECT_FALSE(Match(kOriginDevTools, kExtension, nullptr));
2021 #endif 2021 #endif
2022 } 2022 }
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager_desktop.h ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698