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/autocomplete/contact_provider_chromeos.h" | 5 #include "chrome/browser/autocomplete/contact_provider_chromeos.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 class ContactProviderTest : public testing::Test { | 48 class ContactProviderTest : public testing::Test { |
49 public: | 49 public: |
50 ContactProviderTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} | 50 ContactProviderTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} |
51 virtual ~ContactProviderTest() {} | 51 virtual ~ContactProviderTest() {} |
52 | 52 |
53 protected: | 53 protected: |
54 // testing::Test implementation. | 54 // testing::Test implementation. |
55 virtual void SetUp() OVERRIDE { | 55 virtual void SetUp() OVERRIDE { |
56 profile_manager_.reset( | 56 profile_manager_.reset( |
57 new TestingProfileManager( | 57 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
58 static_cast<TestingBrowserProcess*>(g_browser_process))); | |
59 ASSERT_TRUE(profile_manager_->SetUp()); | 58 ASSERT_TRUE(profile_manager_->SetUp()); |
60 profile_ = profile_manager_->CreateTestingProfile("test_profile"); | 59 profile_ = profile_manager_->CreateTestingProfile("test_profile"); |
61 contact_manager_.reset(new contacts::ContactManagerStub(profile_)); | 60 contact_manager_.reset(new contacts::ContactManagerStub(profile_)); |
62 contact_provider_ = | 61 contact_provider_ = |
63 new ContactProvider(NULL, profile_, contact_manager_->GetWeakPtr()); | 62 new ContactProvider(NULL, profile_, contact_manager_->GetWeakPtr()); |
64 } | 63 } |
65 | 64 |
66 // Starts a (synchronous) query for |utf8_text| in |contact_provider_|. | 65 // Starts a (synchronous) query for |utf8_text| in |contact_provider_|. |
67 void StartQuery(const std::string& utf8_text) { | 66 void StartQuery(const std::string& utf8_text) { |
68 contact_provider_->Start( | 67 contact_provider_->Start( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 EXPECT_EQ(exp_contact.contact_id(), match_id) | 271 EXPECT_EQ(exp_contact.contact_id(), match_id) |
273 << "Expected contact ID " << exp_contact.contact_id() | 272 << "Expected contact ID " << exp_contact.contact_id() |
274 << " for match " << i << " but got " << match_id << " instead"; | 273 << " for match " << i << " but got " << match_id << " instead"; |
275 if (i > 0) { | 274 if (i > 0) { |
276 EXPECT_LE(matches[i].relevance, previous_relevance) | 275 EXPECT_LE(matches[i].relevance, previous_relevance) |
277 << "Match " << i << " has greater relevance than previous match"; | 276 << "Match " << i << " has greater relevance than previous match"; |
278 } | 277 } |
279 previous_relevance = matches[i].relevance; | 278 previous_relevance = matches[i].relevance; |
280 } | 279 } |
281 } | 280 } |
OLD | NEW |