OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/contacts/gdata_contacts_service.h" | 5 #include "chrome/browser/chromeos/contacts/gdata_contacts_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 content::BrowserThread::IO)); | 84 content::BrowserThread::IO)); |
85 | 85 |
86 test_server_.reset( | 86 test_server_.reset( |
87 new net::test_server::EmbeddedTestServer( | 87 new net::test_server::EmbeddedTestServer( |
88 content::BrowserThread::GetMessageLoopProxyForThread( | 88 content::BrowserThread::GetMessageLoopProxyForThread( |
89 content::BrowserThread::IO))); | 89 content::BrowserThread::IO))); |
90 ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady()); | 90 ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady()); |
91 test_server_->RegisterRequestHandler( | 91 test_server_->RegisterRequestHandler( |
92 base::Bind(&GDataContactsServiceTest::HandleDownloadRequest, | 92 base::Bind(&GDataContactsServiceTest::HandleDownloadRequest, |
93 base::Unretained(this))); | 93 base::Unretained(this))); |
94 service_.reset(new GDataContactsService( | 94 service_.reset(new GDataContactsService(request_context_getter_.get(), |
95 request_context_getter_, | 95 profile_.get())); |
96 profile_.get())); | |
97 service_->Initialize(); | 96 service_->Initialize(); |
98 service_->auth_service_for_testing()->set_access_token_for_testing( | 97 service_->auth_service_for_testing()->set_access_token_for_testing( |
99 kTestGDataAuthToken); | 98 kTestGDataAuthToken); |
100 service_->set_rewrite_photo_url_callback_for_testing( | 99 service_->set_rewrite_photo_url_callback_for_testing( |
101 base::Bind(&GDataContactsServiceTest::RewritePhotoUrl, | 100 base::Bind(&GDataContactsServiceTest::RewritePhotoUrl, |
102 base::Unretained(this))); | 101 base::Unretained(this))); |
103 service_->set_groups_feed_url_for_testing( | 102 service_->set_groups_feed_url_for_testing( |
104 test_server_->GetURL(kGroupsFeedFilename)); | 103 test_server_->GetURL(kGroupsFeedFilename)); |
105 service_->set_photo_download_timer_interval_for_testing( | 104 service_->set_photo_download_timer_interval_for_testing( |
106 base::TimeDelta::FromMilliseconds(10)); | 105 base::TimeDelta::FromMilliseconds(10)); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 scoped_ptr<contacts::Contact> contact2(new contacts::Contact); | 335 scoped_ptr<contacts::Contact> contact2(new contacts::Contact); |
337 InitContact("http://example.com/2", "2012-06-21T16:20:13.208Z", | 336 InitContact("http://example.com/2", "2012-06-21T16:20:13.208Z", |
338 false, "Bob Smith", "Bob", "", "Smith", "", "", | 337 false, "Bob Smith", "Bob", "", "Smith", "", "", |
339 contact2.get()); | 338 contact2.get()); |
340 EXPECT_EQ(contacts::test::VarContactsToString( | 339 EXPECT_EQ(contacts::test::VarContactsToString( |
341 2, contact1.get(), contact2.get()), | 340 2, contact1.get(), contact2.get()), |
342 contacts::test::ContactsToString(*contacts)); | 341 contacts::test::ContactsToString(*contacts)); |
343 } | 342 } |
344 | 343 |
345 } // namespace contacts | 344 } // namespace contacts |
OLD | NEW |