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

Side by Side Diff: chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/policy/cloud_external_data_manager_base.h" 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const char kCacheKey[] = "data"; 63 const char kCacheKey[] = "data";
64 64
65 // A variant of net::FakeURLFetcherFactory that makes it an error to request a 65 // A variant of net::FakeURLFetcherFactory that makes it an error to request a
66 // fetcher for an unknown URL. 66 // fetcher for an unknown URL.
67 class FakeURLFetcherFactory : public net::FakeURLFetcherFactory { 67 class FakeURLFetcherFactory : public net::FakeURLFetcherFactory {
68 public: 68 public:
69 FakeURLFetcherFactory(); 69 FakeURLFetcherFactory();
70 ~FakeURLFetcherFactory() override; 70 ~FakeURLFetcherFactory() override;
71 71
72 // net::FakeURLFetcherFactory: 72 // net::FakeURLFetcherFactory:
73 net::URLFetcher* CreateURLFetcher(int id, 73 scoped_ptr<net::URLFetcher> CreateURLFetcher(
74 const GURL& url, 74 int id,
75 net::URLFetcher::RequestType request_type, 75 const GURL& url,
76 net::URLFetcherDelegate* delegate) override; 76 net::URLFetcher::RequestType request_type,
77 net::URLFetcherDelegate* delegate) override;
77 78
78 private: 79 private:
79 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); 80 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory);
80 }; 81 };
81 82
82 FakeURLFetcherFactory::FakeURLFetcherFactory() 83 FakeURLFetcherFactory::FakeURLFetcherFactory()
83 : net::FakeURLFetcherFactory(NULL) { 84 : net::FakeURLFetcherFactory(NULL) {
84 } 85 }
85 86
86 FakeURLFetcherFactory::~FakeURLFetcherFactory() { 87 FakeURLFetcherFactory::~FakeURLFetcherFactory() {
87 } 88 }
88 89
89 net::URLFetcher* FakeURLFetcherFactory::CreateURLFetcher( 90 scoped_ptr<net::URLFetcher> FakeURLFetcherFactory::CreateURLFetcher(
90 int id, 91 int id,
91 const GURL& url, 92 const GURL& url,
92 net::URLFetcher::RequestType request_type, 93 net::URLFetcher::RequestType request_type,
93 net::URLFetcherDelegate* delegate) { 94 net::URLFetcherDelegate* delegate) {
94 net::URLFetcher* fetcher = net::FakeURLFetcherFactory::CreateURLFetcher( 95 scoped_ptr<net::URLFetcher> fetcher =
95 id, url, request_type, delegate); 96 net::FakeURLFetcherFactory::CreateURLFetcher(id, url, request_type,
97 delegate);
96 EXPECT_TRUE(fetcher); 98 EXPECT_TRUE(fetcher);
97 return fetcher; 99 return fetcher.Pass();
98 } 100 }
99 101
100 } // namespace 102 } // namespace
101 103
102 class CloudExternalDataManagerBaseTest : public testing::Test { 104 class CloudExternalDataManagerBaseTest : public testing::Test {
103 protected: 105 protected:
104 CloudExternalDataManagerBaseTest(); 106 CloudExternalDataManagerBaseTest();
105 107
106 void SetUp() override; 108 void SetUp() override;
107 void TearDown() override; 109 void TearDown() override;
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 crypto::SHA256HashString(k10ByteData))); 771 crypto::SHA256HashString(k10ByteData)));
770 cloud_policy_store_.NotifyStoreLoaded(); 772 cloud_policy_store_.NotifyStoreLoaded();
771 base::RunLoop().RunUntilIdle(); 773 base::RunLoop().RunUntilIdle();
772 EXPECT_EQ(1u, callback_data_.size()); 774 EXPECT_EQ(1u, callback_data_.size());
773 ASSERT_TRUE(callback_data_[1]); 775 ASSERT_TRUE(callback_data_[1]);
774 EXPECT_EQ(k10ByteData, *callback_data_[1]); 776 EXPECT_EQ(k10ByteData, *callback_data_[1]);
775 ResetCallbackData(); 777 ResetCallbackData();
776 } 778 }
777 779
778 } // namespace policy 780 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller_browsertest.cc ('k') | chrome/browser/chromeos/policy/upload_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698