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

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

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: works for all platforms commit e75a498951318d4deb65d40ce8b2def44cd5abc0 Created 5 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
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 "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 GCDApiFlowTest() 46 GCDApiFlowTest()
47 : ui_thread_(content::BrowserThread::UI, &loop_), 47 : ui_thread_(content::BrowserThread::UI, &loop_),
48 request_context_(new net::TestURLRequestContextGetter( 48 request_context_(new net::TestURLRequestContextGetter(
49 base::ThreadTaskRunnerHandle::Get())), 49 base::ThreadTaskRunnerHandle::Get())),
50 account_id_(kAccountId) {} 50 account_id_(kAccountId) {}
51 51
52 ~GCDApiFlowTest() override {} 52 ~GCDApiFlowTest() override {}
53 53
54 protected: 54 protected:
55 void SetUp() override { 55 void SetUp() override {
56 token_service_.set_request_context(request_context_.get()); 56 token_service_.GetFakeOAuth2TokenServiceDelegate()->set_request_context(
57 token_service_.AddAccount(account_id_); 57 request_context_.get());
58 token_service_.GetDelegate()->UpdateCredentials(account_id_,
59 "refresh_token");
58 ui_thread_.Stop(); // HACK: Fake being on the UI thread 60 ui_thread_.Stop(); // HACK: Fake being on the UI thread
59 61
60 scoped_ptr<MockDelegate> delegate(new MockDelegate); 62 scoped_ptr<MockDelegate> delegate(new MockDelegate);
61 mock_delegate_ = delegate.get(); 63 mock_delegate_ = delegate.get();
62 EXPECT_CALL(*mock_delegate_, GetURL()) 64 EXPECT_CALL(*mock_delegate_, GetURL())
63 .WillRepeatedly(Return( 65 .WillRepeatedly(Return(
64 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken"))); 66 GURL("https://www.google.com/cloudprint/confirm?token=SomeToken")));
65 gcd_flow_.reset(new GCDApiFlowImpl( 67 gcd_flow_.reset(new GCDApiFlowImpl(
66 request_context_.get(), &token_service_, account_id_)); 68 request_context_.get(), &token_service_, account_id_));
67 gcd_flow_->Start(delegate.Pass()); 69 gcd_flow_->Start(delegate.Pass());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 124
123 EXPECT_CALL(*mock_delegate_, 125 EXPECT_CALL(*mock_delegate_,
124 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE)); 126 OnGCDAPIFlowError(GCDApiFlow::ERROR_MALFORMED_RESPONSE));
125 127
126 fetcher->delegate()->OnURLFetchComplete(fetcher); 128 fetcher->delegate()->OnURLFetchComplete(fetcher);
127 } 129 }
128 130
129 } // namespace 131 } // namespace
130 132
131 } // namespace local_discovery 133 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698