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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" | 9 #include "chrome/browser/local_discovery/cloud_print_printer_list.h" |
10 #include "content/public/test/test_browser_thread.h" | 10 #include "content/public/test/test_browser_thread.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 " \"description\": \"someDescription\"}" | 34 " \"description\": \"someDescription\"}" |
35 " ]" | 35 " ]" |
36 "}"; | 36 "}"; |
37 | 37 |
38 class TestOAuth2TokenService : public OAuth2TokenService { | 38 class TestOAuth2TokenService : public OAuth2TokenService { |
39 public: | 39 public: |
40 explicit TestOAuth2TokenService(net::URLRequestContextGetter* request_context) | 40 explicit TestOAuth2TokenService(net::URLRequestContextGetter* request_context) |
41 : request_context_(request_context) { | 41 : request_context_(request_context) { |
42 } | 42 } |
43 protected: | 43 protected: |
44 virtual std::string GetRefreshToken() OVERRIDE { | 44 virtual std::string GetRefreshToken(const std::string& account_id) OVERRIDE { |
45 return "SampleToken"; | 45 return "SampleToken"; |
46 } | 46 } |
47 | 47 |
48 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE { | 48 virtual net::URLRequestContextGetter* GetRequestContext() OVERRIDE { |
49 return request_context_.get(); | 49 return request_context_.get(); |
50 } | 50 } |
51 | 51 |
52 private: | 52 private: |
53 scoped_refptr<net::URLRequestContextGetter> request_context_; | 53 scoped_refptr<net::URLRequestContextGetter> request_context_; |
54 }; | 54 }; |
(...skipping 11 matching lines...) Expand all Loading... |
66 &loop_), | 66 &loop_), |
67 request_context_(new net::TestURLRequestContextGetter( | 67 request_context_(new net::TestURLRequestContextGetter( |
68 base::MessageLoopProxy::current())), | 68 base::MessageLoopProxy::current())), |
69 token_service_(request_context_.get()) { | 69 token_service_(request_context_.get()) { |
70 ui_thread_.Stop(); // HACK: Fake being on the UI thread | 70 ui_thread_.Stop(); // HACK: Fake being on the UI thread |
71 | 71 |
72 printer_list_.reset( | 72 printer_list_.reset( |
73 new CloudPrintPrinterList(request_context_.get(), | 73 new CloudPrintPrinterList(request_context_.get(), |
74 "http://SoMeUrL.com/cloudprint", | 74 "http://SoMeUrL.com/cloudprint", |
75 &token_service_, | 75 &token_service_, |
| 76 "account_id", |
76 &delegate_)); | 77 &delegate_)); |
77 | 78 |
78 fallback_fetcher_factory_.reset(new net::TestURLFetcherFactory()); | 79 fallback_fetcher_factory_.reset(new net::TestURLFetcherFactory()); |
79 net::URLFetcherImpl::set_factory(NULL); | 80 net::URLFetcherImpl::set_factory(NULL); |
80 fetcher_factory_.reset(new net::FakeURLFetcherFactory( | 81 fetcher_factory_.reset(new net::FakeURLFetcherFactory( |
81 fallback_fetcher_factory_.get())); | 82 fallback_fetcher_factory_.get())); |
82 } | 83 } |
83 | 84 |
84 virtual ~CloudPrintPrinterListTest() { | 85 virtual ~CloudPrintPrinterListTest() { |
85 fetcher_factory_.reset(); | 86 fetcher_factory_.reset(); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 printer_list_->GetDetailsFor("someID"); | 138 printer_list_->GetDetailsFor("someID"); |
138 ASSERT_TRUE(found != NULL); | 139 ASSERT_TRUE(found != NULL); |
139 EXPECT_EQ("someID", found->id); | 140 EXPECT_EQ("someID", found->id); |
140 EXPECT_EQ("someDisplayName", found->display_name); | 141 EXPECT_EQ("someDisplayName", found->display_name); |
141 EXPECT_EQ("someDescription", found->description); | 142 EXPECT_EQ("someDescription", found->description); |
142 } | 143 } |
143 | 144 |
144 } // namespace | 145 } // namespace |
145 | 146 |
146 } // namespace local_discovery | 147 } // namespace local_discovery |
OLD | NEW |