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/local_discovery/privet_url_fetcher.h" | 5 #include "chrome/browser/local_discovery/privet_url_fetcher.h" |
6 #include "net/url_request/test_url_fetcher_factory.h" | 6 #include "net/url_request/test_url_fetcher_factory.h" |
7 #include "net/url_request/url_request_test_util.h" | 7 #include "net/url_request/url_request_test_util.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 class MockPrivetURLFetcherDelegate : public PrivetURLFetcher::Delegate { | 26 class MockPrivetURLFetcherDelegate : public PrivetURLFetcher::Delegate { |
27 public: | 27 public: |
28 MockPrivetURLFetcherDelegate() : raw_mode_(false) { | 28 MockPrivetURLFetcherDelegate() : raw_mode_(false) { |
29 } | 29 } |
30 | 30 |
31 virtual ~MockPrivetURLFetcherDelegate() { | 31 virtual ~MockPrivetURLFetcherDelegate() { |
32 } | 32 } |
33 | 33 |
34 virtual void OnError(PrivetURLFetcher* fetcher, | 34 virtual void OnError(PrivetURLFetcher* fetcher, |
35 PrivetURLFetcher::ErrorType error) OVERRIDE { | 35 PrivetURLFetcher::ErrorType error) override { |
36 OnErrorInternal(error); | 36 OnErrorInternal(error); |
37 } | 37 } |
38 | 38 |
39 MOCK_METHOD1(OnErrorInternal, void(PrivetURLFetcher::ErrorType error)); | 39 MOCK_METHOD1(OnErrorInternal, void(PrivetURLFetcher::ErrorType error)); |
40 | 40 |
41 virtual void OnParsedJson(PrivetURLFetcher* fetcher, | 41 virtual void OnParsedJson(PrivetURLFetcher* fetcher, |
42 const base::DictionaryValue& value, | 42 const base::DictionaryValue& value, |
43 bool has_error) OVERRIDE { | 43 bool has_error) override { |
44 saved_value_.reset(value.DeepCopy()); | 44 saved_value_.reset(value.DeepCopy()); |
45 OnParsedJsonInternal(has_error); | 45 OnParsedJsonInternal(has_error); |
46 } | 46 } |
47 | 47 |
48 MOCK_METHOD1(OnParsedJsonInternal, void(bool has_error)); | 48 MOCK_METHOD1(OnParsedJsonInternal, void(bool has_error)); |
49 | 49 |
50 virtual void OnNeedPrivetToken( | 50 virtual void OnNeedPrivetToken( |
51 PrivetURLFetcher* fetcher, | 51 PrivetURLFetcher* fetcher, |
52 const PrivetURLFetcher::TokenCallback& callback) { | 52 const PrivetURLFetcher::TokenCallback& callback) { |
53 } | 53 } |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 311 |
312 std::string header_token; | 312 std::string header_token; |
313 ASSERT_FALSE(headers.GetHeader("X-Privet-Token", &header_token)); | 313 ASSERT_FALSE(headers.GetHeader("X-Privet-Token", &header_token)); |
314 ASSERT_TRUE(headers.GetHeader("X-Privet-Auth", &header_token)); | 314 ASSERT_TRUE(headers.GetHeader("X-Privet-Auth", &header_token)); |
315 ASSERT_EQ("MyAuthToken", header_token); | 315 ASSERT_EQ("MyAuthToken", header_token); |
316 } | 316 } |
317 | 317 |
318 } // namespace | 318 } // namespace |
319 | 319 |
320 } // namespace local_discovery | 320 } // namespace local_discovery |
OLD | NEW |