| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "net/base/sdch_dictionary_fetcher.h" | 5 #include "net/base/sdch_dictionary_fetcher.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 std::vector<DictionaryAdditions> dictionary_additions; | 101 std::vector<DictionaryAdditions> dictionary_additions; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 class SdchDictionaryFetcherTest : public ::testing::Test { | 104 class SdchDictionaryFetcherTest : public ::testing::Test { |
| 105 public: | 105 public: |
| 106 SdchDictionaryFetcherTest() {} | 106 SdchDictionaryFetcherTest() {} |
| 107 | 107 |
| 108 virtual void SetUp() override { | 108 void SetUp() override { |
| 109 DCHECK(!fetcher_.get()); | 109 DCHECK(!fetcher_.get()); |
| 110 | 110 |
| 111 URLRequestSpecifiedResponseJob::AddUrlHandler(); | 111 URLRequestSpecifiedResponseJob::AddUrlHandler(); |
| 112 fetcher_delegate_.reset(new SdchTestDelegate); | 112 fetcher_delegate_.reset(new SdchTestDelegate); |
| 113 context_.reset(new TestURLRequestContext); | 113 context_.reset(new TestURLRequestContext); |
| 114 fetcher_.reset(new SdchDictionaryFetcher( | 114 fetcher_.reset(new SdchDictionaryFetcher( |
| 115 fetcher_delegate_.get(), context_.get())); | 115 fetcher_delegate_.get(), context_.get())); |
| 116 } | 116 } |
| 117 | 117 |
| 118 virtual void TearDown() override { | 118 void TearDown() override { |
| 119 URLRequestSpecifiedResponseJob::RemoveUrlHandler(); | 119 URLRequestSpecifiedResponseJob::RemoveUrlHandler(); |
| 120 fetcher_.reset(); | 120 fetcher_.reset(); |
| 121 context_.reset(); | 121 context_.reset(); |
| 122 fetcher_delegate_.reset(); | 122 fetcher_delegate_.reset(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 SdchDictionaryFetcher* fetcher() { return fetcher_.get(); } | 125 SdchDictionaryFetcher* fetcher() { return fetcher_.get(); } |
| 126 SdchTestDelegate* manager() { return fetcher_delegate_.get(); } | 126 SdchTestDelegate* manager() { return fetcher_delegate_.get(); } |
| 127 | 127 |
| 128 // May not be called outside the SetUp()/TearDown() interval. | 128 // May not be called outside the SetUp()/TearDown() interval. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 fetcher()->Schedule(dictionary_url_2); | 184 fetcher()->Schedule(dictionary_url_2); |
| 185 fetcher()->Schedule(dictionary_url_3); | 185 fetcher()->Schedule(dictionary_url_3); |
| 186 fetcher()->Cancel(); | 186 fetcher()->Cancel(); |
| 187 base::RunLoop().RunUntilIdle(); | 187 base::RunLoop().RunUntilIdle(); |
| 188 | 188 |
| 189 // Synchronous execution may have resulted in a single job being scheduled. | 189 // Synchronous execution may have resulted in a single job being scheduled. |
| 190 EXPECT_GE(1, JobsRequested()); | 190 EXPECT_GE(1, JobsRequested()); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } | 193 } |
| OLD | NEW |