Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/local_discovery/gcd_api_flow_unittest.cc

Issue 318283002: Added new GCD/Privet interfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "content/public/test/test_browser_thread.h" 9 #include "content/public/test/test_browser_thread.h"
10 #include "google_apis/gaia/fake_oauth2_token_service.h" 10 #include "google_apis/gaia/fake_oauth2_token_service.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 virtual void SetUp() OVERRIDE { 52 virtual void SetUp() OVERRIDE {
53 token_service_.set_request_context(request_context_.get()); 53 token_service_.set_request_context(request_context_.get());
54 token_service_.AddAccount(account_id_); 54 token_service_.AddAccount(account_id_);
55 ui_thread_.Stop(); // HACK: Fake being on the UI thread 55 ui_thread_.Stop(); // HACK: Fake being on the UI thread
56 56
57 scoped_ptr<MockDelegate> delegate(new MockDelegate); 57 scoped_ptr<MockDelegate> delegate(new MockDelegate);
58 mock_delegate_ = delegate.get(); 58 mock_delegate_ = delegate.get();
59 EXPECT_CALL(*mock_delegate_, GetURL()) 59 EXPECT_CALL(*mock_delegate_, GetURL())
60 .WillRepeatedly(Return( 60 .WillRepeatedly(Return(
61 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken"))); 61 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken")));
62 gcd_flow_.reset(new GCDApiFlow(request_context_.get(), 62 gcd_flow_.reset(
63 &token_service_, 63 new GCDApiFlow(request_context_.get(), &token_service_, account_id_));
64 account_id_, 64 gcd_flow_->Start(delegate.PassAs<GCDApiFlow::Request>());
65 delegate.PassAs<GCDApiFlow::Request>()));
66 gcd_flow_->Start();
67 } 65 }
68 base::MessageLoopForUI loop_; 66 base::MessageLoopForUI loop_;
69 content::TestBrowserThread ui_thread_; 67 content::TestBrowserThread ui_thread_;
70 scoped_refptr<net::TestURLRequestContextGetter> request_context_; 68 scoped_refptr<net::TestURLRequestContextGetter> request_context_;
71 net::TestURLFetcherFactory fetcher_factory_; 69 net::TestURLFetcherFactory fetcher_factory_;
72 FakeOAuth2TokenService token_service_; 70 FakeOAuth2TokenService token_service_;
73 std::string account_id_; 71 std::string account_id_;
74 scoped_ptr<GCDApiFlow> gcd_flow_; 72 scoped_ptr<GCDApiFlow> gcd_flow_;
75 MockDelegate* mock_delegate_; 73 MockDelegate* mock_delegate_;
76 }; 74 };
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 119
122 EXPECT_CALL(*mock_delegate_, 120 EXPECT_CALL(*mock_delegate_,
123 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE)); 121 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE));
124 122
125 fetcher->delegate()->OnURLFetchComplete(fetcher); 123 fetcher->delegate()->OnURLFetchComplete(fetcher);
126 } 124 }
127 125
128 } // namespace 126 } // namespace
129 127
130 } // namespace local_discovery 128 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698