| 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 <cstdio> | 5 #include <cstdio> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 history_service_->SetOnBackendDestroyTask(MessageLoop::QuitClosure()); | 109 history_service_->SetOnBackendDestroyTask(MessageLoop::QuitClosure()); |
| 110 history_service_->Cleanup(); | 110 history_service_->Cleanup(); |
| 111 history_service_ = NULL; | 111 history_service_ = NULL; |
| 112 | 112 |
| 113 // Wait for the backend class to terminate before deleting the files and | 113 // Wait for the backend class to terminate before deleting the files and |
| 114 // moving to the next test. Note: if this never terminates, somebody is | 114 // moving to the next test. Note: if this never terminates, somebody is |
| 115 // probably leaking a reference to the history backend, so it never calls | 115 // probably leaking a reference to the history backend, so it never calls |
| 116 // our destroy task. | 116 // our destroy task. |
| 117 MessageLoop::current()->Run(); | 117 MessageLoop::current()->Run(); |
| 118 } | 118 } |
| 119 |
| 120 // Wait for all pending file I/O to be completed. |
| 121 BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 119 } | 122 } |
| 120 | 123 |
| 121 // Loads the database from disk and makes sure that the same URLs are present | 124 // Loads the database from disk and makes sure that the same URLs are present |
| 122 // as were generated by TestIO_Create(). This also checks the URLs with a | 125 // as were generated by TestIO_Create(). This also checks the URLs with a |
| 123 // slave to make sure it reads the data properly. | 126 // slave to make sure it reads the data properly. |
| 124 void Reload() { | 127 void Reload() { |
| 125 // Clean up after our caller, who may have left the database open. | 128 // Clean up after our caller, who may have left the database open. |
| 126 ClearDB(); | 129 ClearDB(); |
| 127 | 130 |
| 128 ASSERT_TRUE(InitHistory()); | 131 ASSERT_TRUE(InitHistory()); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 EXPECT_EQ(1, profile()->add_event_count()); | 723 EXPECT_EQ(1, profile()->add_event_count()); |
| 721 EXPECT_EQ(0, profile()->reset_event_count()); | 724 EXPECT_EQ(0, profile()->reset_event_count()); |
| 722 | 725 |
| 723 // Activate the tab. | 726 // Activate the tab. |
| 724 rvh()->WasRestored(); | 727 rvh()->WasRestored(); |
| 725 | 728 |
| 726 // We should have only one more reset event. | 729 // We should have only one more reset event. |
| 727 EXPECT_EQ(1, profile()->add_event_count()); | 730 EXPECT_EQ(1, profile()->add_event_count()); |
| 728 EXPECT_EQ(1, profile()->reset_event_count()); | 731 EXPECT_EQ(1, profile()->reset_event_count()); |
| 729 } | 732 } |
| OLD | NEW |