OLD | NEW |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class FakeURLFetcherFactory : public net::FakeURLFetcherFactory { | 67 class FakeURLFetcherFactory : public net::FakeURLFetcherFactory { |
68 public: | 68 public: |
69 FakeURLFetcherFactory(); | 69 FakeURLFetcherFactory(); |
70 virtual ~FakeURLFetcherFactory(); | 70 virtual ~FakeURLFetcherFactory(); |
71 | 71 |
72 // net::FakeURLFetcherFactory: | 72 // net::FakeURLFetcherFactory: |
73 virtual net::URLFetcher* CreateURLFetcher( | 73 virtual net::URLFetcher* CreateURLFetcher( |
74 int id, | 74 int id, |
75 const GURL& url, | 75 const GURL& url, |
76 net::URLFetcher::RequestType request_type, | 76 net::URLFetcher::RequestType request_type, |
77 net::URLFetcherDelegate* delegate) OVERRIDE; | 77 net::URLFetcherDelegate* delegate) override; |
78 | 78 |
79 private: | 79 private: |
80 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); | 80 DISALLOW_COPY_AND_ASSIGN(FakeURLFetcherFactory); |
81 }; | 81 }; |
82 | 82 |
83 FakeURLFetcherFactory::FakeURLFetcherFactory() | 83 FakeURLFetcherFactory::FakeURLFetcherFactory() |
84 : net::FakeURLFetcherFactory(NULL) { | 84 : net::FakeURLFetcherFactory(NULL) { |
85 } | 85 } |
86 | 86 |
87 FakeURLFetcherFactory::~FakeURLFetcherFactory() { | 87 FakeURLFetcherFactory::~FakeURLFetcherFactory() { |
88 } | 88 } |
89 | 89 |
90 net::URLFetcher* FakeURLFetcherFactory::CreateURLFetcher( | 90 net::URLFetcher* FakeURLFetcherFactory::CreateURLFetcher( |
91 int id, | 91 int id, |
92 const GURL& url, | 92 const GURL& url, |
93 net::URLFetcher::RequestType request_type, | 93 net::URLFetcher::RequestType request_type, |
94 net::URLFetcherDelegate* delegate) { | 94 net::URLFetcherDelegate* delegate) { |
95 net::URLFetcher* fetcher = net::FakeURLFetcherFactory::CreateURLFetcher( | 95 net::URLFetcher* fetcher = net::FakeURLFetcherFactory::CreateURLFetcher( |
96 id, url, request_type, delegate); | 96 id, url, request_type, delegate); |
97 EXPECT_TRUE(fetcher); | 97 EXPECT_TRUE(fetcher); |
98 return fetcher; | 98 return fetcher; |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 class CloudExternalDataManagerBaseTest : public testing::Test { | 103 class CloudExternalDataManagerBaseTest : public testing::Test { |
104 protected: | 104 protected: |
105 CloudExternalDataManagerBaseTest(); | 105 CloudExternalDataManagerBaseTest(); |
106 | 106 |
107 virtual void SetUp() OVERRIDE; | 107 virtual void SetUp() override; |
108 virtual void TearDown() OVERRIDE; | 108 virtual void TearDown() override; |
109 | 109 |
110 void SetUpExternalDataManager(); | 110 void SetUpExternalDataManager(); |
111 | 111 |
112 scoped_ptr<base::DictionaryValue> ConstructMetadata(const std::string& url, | 112 scoped_ptr<base::DictionaryValue> ConstructMetadata(const std::string& url, |
113 const std::string& hash); | 113 const std::string& hash); |
114 void SetExternalDataReference(const std::string& policy, | 114 void SetExternalDataReference(const std::string& policy, |
115 scoped_ptr<base::DictionaryValue> metadata); | 115 scoped_ptr<base::DictionaryValue> metadata); |
116 | 116 |
117 ExternalDataFetcher::FetchCallback ConstructFetchCallback(int id); | 117 ExternalDataFetcher::FetchCallback ConstructFetchCallback(int id); |
118 void ResetCallbackData(); | 118 void ResetCallbackData(); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 crypto::SHA256HashString(k10ByteData))); | 769 crypto::SHA256HashString(k10ByteData))); |
770 cloud_policy_store_.NotifyStoreLoaded(); | 770 cloud_policy_store_.NotifyStoreLoaded(); |
771 base::RunLoop().RunUntilIdle(); | 771 base::RunLoop().RunUntilIdle(); |
772 EXPECT_EQ(1u, callback_data_.size()); | 772 EXPECT_EQ(1u, callback_data_.size()); |
773 ASSERT_TRUE(callback_data_[1]); | 773 ASSERT_TRUE(callback_data_[1]); |
774 EXPECT_EQ(k10ByteData, *callback_data_[1]); | 774 EXPECT_EQ(k10ByteData, *callback_data_[1]); |
775 ResetCallbackData(); | 775 ResetCallbackData(); |
776 } | 776 } |
777 | 777 |
778 } // namespace policy | 778 } // namespace policy |
OLD | NEW |