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 28 matching lines...) Expand all Loading... |
39 OnParsedJsonInternal(has_error); | 39 OnParsedJsonInternal(has_error); |
40 } | 40 } |
41 | 41 |
42 MOCK_METHOD1(OnParsedJsonInternal, void(bool has_error)); | 42 MOCK_METHOD1(OnParsedJsonInternal, void(bool has_error)); |
43 | 43 |
44 virtual void OnNeedPrivetToken( | 44 virtual void OnNeedPrivetToken( |
45 PrivetURLFetcher* fetcher, | 45 PrivetURLFetcher* fetcher, |
46 const PrivetURLFetcher::TokenCallback& callback) { | 46 const PrivetURLFetcher::TokenCallback& callback) { |
47 } | 47 } |
48 | 48 |
49 const DictionaryValue* saved_value() { return saved_value_.get(); } | 49 const base::DictionaryValue* saved_value() { return saved_value_.get(); } |
50 | 50 |
51 private: | 51 private: |
52 scoped_ptr<DictionaryValue> saved_value_; | 52 scoped_ptr<base::DictionaryValue> saved_value_; |
53 }; | 53 }; |
54 | 54 |
55 class PrivetURLFetcherTest : public ::testing::Test { | 55 class PrivetURLFetcherTest : public ::testing::Test { |
56 public: | 56 public: |
57 PrivetURLFetcherTest() { | 57 PrivetURLFetcherTest() { |
58 request_context_= new net::TestURLRequestContextGetter( | 58 request_context_= new net::TestURLRequestContextGetter( |
59 base::MessageLoopProxy::current()); | 59 base::MessageLoopProxy::current()); |
60 privet_urlfetcher_.reset(new PrivetURLFetcher( | 60 privet_urlfetcher_.reset(new PrivetURLFetcher( |
61 kSamplePrivetToken, | 61 kSamplePrivetToken, |
62 GURL(kSamplePrivetURL), | 62 GURL(kSamplePrivetURL), |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 net::OK)); | 226 net::OK)); |
227 fetcher->set_response_code(200); | 227 fetcher->set_response_code(200); |
228 | 228 |
229 EXPECT_CALL(delegate_, OnParsedJsonInternal(true)); | 229 EXPECT_CALL(delegate_, OnParsedJsonInternal(true)); |
230 fetcher->delegate()->OnURLFetchComplete(fetcher); | 230 fetcher->delegate()->OnURLFetchComplete(fetcher); |
231 } | 231 } |
232 | 232 |
233 } // namespace | 233 } // namespace |
234 | 234 |
235 } // namespace local_discovery | 235 } // namespace local_discovery |
OLD | NEW |