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 "chrome/browser/local_discovery/gcd_api_flow.h" | 5 #include "chrome/browser/local_discovery/gcd_api_flow.h" |
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 "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/local_discovery/gcd_api_flow_impl.h" | 10 #include "chrome/browser/local_discovery/gcd_api_flow_impl.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 token_service_.AddAccount(account_id_); | 56 token_service_.AddAccount(account_id_); |
57 ui_thread_.Stop(); // HACK: Fake being on the UI thread | 57 ui_thread_.Stop(); // HACK: Fake being on the UI thread |
58 | 58 |
59 scoped_ptr<MockDelegate> delegate(new MockDelegate); | 59 scoped_ptr<MockDelegate> delegate(new MockDelegate); |
60 mock_delegate_ = delegate.get(); | 60 mock_delegate_ = delegate.get(); |
61 EXPECT_CALL(*mock_delegate_, GetURL()) | 61 EXPECT_CALL(*mock_delegate_, GetURL()) |
62 .WillRepeatedly(Return( | 62 .WillRepeatedly(Return( |
63 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken"))); | 63 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken"))); |
64 gcd_flow_.reset(new GCDApiFlowImpl( | 64 gcd_flow_.reset(new GCDApiFlowImpl( |
65 request_context_.get(), &token_service_, account_id_)); | 65 request_context_.get(), &token_service_, account_id_)); |
66 gcd_flow_->Start(delegate.PassAs<GCDApiFlow::Request>()); | 66 gcd_flow_->Start(delegate.Pass()); |
67 } | 67 } |
68 base::MessageLoopForUI loop_; | 68 base::MessageLoopForUI loop_; |
69 content::TestBrowserThread ui_thread_; | 69 content::TestBrowserThread ui_thread_; |
70 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 70 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
71 net::TestURLFetcherFactory fetcher_factory_; | 71 net::TestURLFetcherFactory fetcher_factory_; |
72 FakeOAuth2TokenService token_service_; | 72 FakeOAuth2TokenService token_service_; |
73 std::string account_id_; | 73 std::string account_id_; |
74 scoped_ptr<GCDApiFlowImpl> gcd_flow_; | 74 scoped_ptr<GCDApiFlowImpl> gcd_flow_; |
75 MockDelegate* mock_delegate_; | 75 MockDelegate* mock_delegate_; |
76 }; | 76 }; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 EXPECT_CALL(*mock_delegate_, | 122 EXPECT_CALL(*mock_delegate_, |
123 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE)); | 123 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE)); |
124 | 124 |
125 fetcher->delegate()->OnURLFetchComplete(fetcher); | 125 fetcher->delegate()->OnURLFetchComplete(fetcher); |
126 } | 126 } |
127 | 127 |
128 } // namespace | 128 } // namespace |
129 | 129 |
130 } // namespace local_discovery | 130 } // namespace local_discovery |
OLD | NEW |