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