| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/metrics/field_trial.h" | 5 #include "base/metrics/field_trial.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/test/mock_entropy_provider.h" | 8 #include "base/test/mock_entropy_provider.h" |
| 9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 11 #include "net/test/spawned_test_server/spawned_test_server.h" | 11 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 12 #include "net/url_request/test_url_fetcher_factory.h" | 12 #include "net/url_request/test_url_fetcher_factory.h" |
| 13 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
| 14 #include "net/url_request/url_request_test_util.h" | 14 #include "net/url_request/url_request_test_util.h" |
| 15 #include "sync/internal_api/public/base/cancelation_signal.h" | 15 #include "sync/internal_api/public/base/cancelation_signal.h" |
| 16 #include "sync/internal_api/public/http_bridge.h" | 16 #include "sync/internal_api/public/http_bridge.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #include "third_party/zlib/zlib.h" | 18 #include "third_party/zlib/zlib.h" |
| 19 | 19 |
| 20 namespace syncer { | 20 namespace syncer { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. | 24 // TODO(timsteele): Should use PathService here. See Chromium Issue 3113. |
| 25 const base::FilePath::CharType kDocRoot[] = | 25 const base::FilePath::CharType kDocRoot[] = |
| 26 FILE_PATH_LITERAL("chrome/test/data"); | 26 FILE_PATH_LITERAL("chrome/test/data"); |
| 27 | 27 |
| 28 // ----------------------------------------------------------------------------- | 28 // ----------------------------------------------------------------------------- |
| 29 // The rest of the code in the anon namespace is copied from | 29 // The rest of the code in the anon namespace is copied from |
| 30 // components/metrics/compression_utils.cc | 30 // components/compression/compression_utils.cc |
| 31 // TODO(gangwu): crbug.com/515695. The following codes are copied from | 31 // TODO(gangwu): crbug.com/515695. The following codes are copied from |
| 32 // components/metrics/compression_utils.cc, we copied them because if we | 32 // components/compression/compression_utils.cc, we copied them because if we |
| 33 // reference them, we will get cycle dependency warning. Once the functions | 33 // reference them, we will get cycle dependency warning. Once the functions |
| 34 // have been moved from //component to //base, we can remove the following | 34 // have been moved from //component to //base, we can remove the following |
| 35 // functions. | 35 // functions. |
| 36 //------------------------------------------------------------------------------ | 36 //------------------------------------------------------------------------------ |
| 37 // Pass an integer greater than the following get a gzip header instead of a | 37 // Pass an integer greater than the following get a gzip header instead of a |
| 38 // zlib header when calling deflateInit2() and inflateInit2(). | 38 // zlib header when calling deflateInit2() and inflateInit2(). |
| 39 const int kWindowBitsToGetGzipHeader = 16; | 39 const int kWindowBitsToGetGzipHeader = 16; |
| 40 | 40 |
| 41 // This code is taken almost verbatim from third_party/zlib/uncompr.c. The only | 41 // This code is taken almost verbatim from third_party/zlib/uncompr.c. The only |
| 42 // difference is inflateInit2() is called which sets the window bits to be > 16. | 42 // difference is inflateInit2() is called which sets the window bits to be > 16. |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 673 |
| 674 // Sync thread: Finally run the posted task, only to find that our | 674 // Sync thread: Finally run the posted task, only to find that our |
| 675 // HttpBridgeFactory has been neutered. Should not crash. | 675 // HttpBridgeFactory has been neutered. Should not crash. |
| 676 factory->Init("TestUserAgent"); | 676 factory->Init("TestUserAgent"); |
| 677 | 677 |
| 678 // At this point, attempting to use the factory would trigger a crash. Both | 678 // At this point, attempting to use the factory would trigger a crash. Both |
| 679 // this test and the real world code should make sure this never happens. | 679 // this test and the real world code should make sure this never happens. |
| 680 }; | 680 }; |
| 681 | 681 |
| 682 } // namespace syncer | 682 } // namespace syncer |
| OLD | NEW |