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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 protected: | 79 protected: |
80 virtual void SetUp() { | 80 virtual void SetUp() { |
81 db_thread_.Start(); | 81 db_thread_.Start(); |
82 | 82 |
83 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 83 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
84 wds_ = new WebDataService(); | 84 wds_ = new WebDataService(); |
85 wds_->Init(temp_dir_.path()); | 85 wds_->Init(temp_dir_.path()); |
86 } | 86 } |
87 | 87 |
88 virtual void TearDown() { | 88 virtual void TearDown() { |
89 if (wds_.get()) | 89 wds_->ShutdownOnUIThread(); |
90 wds_->Shutdown(); | 90 wds_ = NULL; |
| 91 base::WaitableEvent done(false, false); |
| 92 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, |
| 93 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); |
| 94 done.Wait(); |
91 | 95 |
92 db_thread_.Stop(); | 96 db_thread_.Stop(); |
93 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 97 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
94 MessageLoop::current()->Run(); | 98 MessageLoop::current()->Run(); |
95 } | 99 } |
96 | 100 |
97 MessageLoopForUI message_loop_; | 101 MessageLoopForUI message_loop_; |
98 content::TestBrowserThread ui_thread_; | 102 content::TestBrowserThread ui_thread_; |
99 content::TestBrowserThread db_thread_; | 103 content::TestBrowserThread db_thread_; |
100 FilePath profile_dir_; | 104 FilePath profile_dir_; |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 #endif // defined(ENABLE_WEB_INTENTS) | 794 #endif // defined(ENABLE_WEB_INTENTS) |
791 | 795 |
792 TEST_F(WebDataServiceTest, DidDefaultSearchProviderChangeOnNewProfile) { | 796 TEST_F(WebDataServiceTest, DidDefaultSearchProviderChangeOnNewProfile) { |
793 KeywordsConsumer consumer; | 797 KeywordsConsumer consumer; |
794 wds_->GetKeywords(&consumer); | 798 wds_->GetKeywords(&consumer); |
795 WaitUntilCalled(); | 799 WaitUntilCalled(); |
796 ASSERT_TRUE(consumer.load_succeeded); | 800 ASSERT_TRUE(consumer.load_succeeded); |
797 EXPECT_FALSE(consumer.keywords_result.did_default_search_provider_change); | 801 EXPECT_FALSE(consumer.keywords_result.did_default_search_provider_change); |
798 EXPECT_FALSE(consumer.keywords_result.backup_valid); | 802 EXPECT_FALSE(consumer.keywords_result.backup_valid); |
799 } | 803 } |
OLD | NEW |