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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 public: | 44 public: |
45 GCDApiFlowTest() | 45 GCDApiFlowTest() |
46 : ui_thread_(content::BrowserThread::UI, &loop_), | 46 : ui_thread_(content::BrowserThread::UI, &loop_), |
47 request_context_(new net::TestURLRequestContextGetter( | 47 request_context_(new net::TestURLRequestContextGetter( |
48 base::MessageLoopProxy::current())), | 48 base::MessageLoopProxy::current())), |
49 account_id_(kAccountId) {} | 49 account_id_(kAccountId) {} |
50 | 50 |
51 virtual ~GCDApiFlowTest() {} | 51 virtual ~GCDApiFlowTest() {} |
52 | 52 |
53 protected: | 53 protected: |
54 virtual void SetUp() OVERRIDE { | 54 virtual void SetUp() override { |
55 token_service_.set_request_context(request_context_.get()); | 55 token_service_.set_request_context(request_context_.get()); |
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( |
(...skipping 56 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 |