| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 TEST_F(TemplateURLServiceTest, GenerateSearchURLUsingTermsData) { | 494 TEST_F(TemplateURLServiceTest, GenerateSearchURLUsingTermsData) { |
| 495 // Run the test for GenerateSearchURLUsingTermsData on the "IO" thread and | 495 // Run the test for GenerateSearchURLUsingTermsData on the "IO" thread and |
| 496 // wait for it to finish. | 496 // wait for it to finish. |
| 497 TestSearchTermsData search_terms_data("http://google.com/"); | 497 TestSearchTermsData search_terms_data("http://google.com/"); |
| 498 scoped_refptr<TestGenerateSearchURL> test_generate_search_url( | 498 scoped_refptr<TestGenerateSearchURL> test_generate_search_url( |
| 499 new TestGenerateSearchURL(&search_terms_data)); | 499 new TestGenerateSearchURL(&search_terms_data)); |
| 500 | 500 |
| 501 test_util_.StartIOThread(); | 501 test_util_.StartIOThread(); |
| 502 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)->PostTask( | 502 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)->PostTask( |
| 503 FROM_HERE, | 503 FROM_HERE, base::Bind(&TestGenerateSearchURL::RunTest, |
| 504 NewRunnableMethod(test_generate_search_url.get(), | 504 test_generate_search_url.get())); |
| 505 &TestGenerateSearchURL::RunTest)); | |
| 506 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); | 505 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); |
| 507 EXPECT_TRUE(test_generate_search_url->passed()); | 506 EXPECT_TRUE(test_generate_search_url->passed()); |
| 508 } | 507 } |
| 509 | 508 |
| 510 TEST_F(TemplateURLServiceTest, ClearBrowsingData_Keywords) { | 509 TEST_F(TemplateURLServiceTest, ClearBrowsingData_Keywords) { |
| 511 Time now = Time::Now(); | 510 Time now = Time::Now(); |
| 512 TimeDelta one_day = TimeDelta::FromDays(1); | 511 TimeDelta one_day = TimeDelta::FromDays(1); |
| 513 Time month_ago = now - TimeDelta::FromDays(30); | 512 Time month_ago = now - TimeDelta::FromDays(30); |
| 514 | 513 |
| 515 // Nothing has been added. | 514 // Nothing has been added. |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 | 1268 |
| 1270 // Reload the model to verify it was actually saved to the database and | 1269 // Reload the model to verify it was actually saved to the database and |
| 1271 // assigned a new GUID when brought back. | 1270 // assigned a new GUID when brought back. |
| 1272 ResetModel(true); | 1271 ResetModel(true); |
| 1273 ASSERT_EQ(1 + initial_count, model()->GetTemplateURLs().size()); | 1272 ASSERT_EQ(1 + initial_count, model()->GetTemplateURLs().size()); |
| 1274 const TemplateURL* loaded_url = | 1273 const TemplateURL* loaded_url = |
| 1275 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); | 1274 model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); |
| 1276 ASSERT_TRUE(loaded_url != NULL); | 1275 ASSERT_TRUE(loaded_url != NULL); |
| 1277 ASSERT_FALSE(loaded_url->sync_guid().empty()); | 1276 ASSERT_FALSE(loaded_url->sync_guid().empty()); |
| 1278 } | 1277 } |
| OLD | NEW |