Chromium Code Reviews| 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 "chrome/browser/extensions/extension_service_unittest.h" | 5 #include "chrome/browser/extensions/extension_service_unittest.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2754 FilePath lso_path = context->GetLocalStorageFilePath(origin_id); | 2754 FilePath lso_path = context->GetLocalStorageFilePath(origin_id); |
| 2755 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName())); | 2755 EXPECT_TRUE(file_util::CreateDirectory(lso_path.DirName())); |
| 2756 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0)); | 2756 EXPECT_EQ(0, file_util::WriteFile(lso_path, NULL, 0)); |
| 2757 EXPECT_TRUE(file_util::PathExists(lso_path)); | 2757 EXPECT_TRUE(file_util::PathExists(lso_path)); |
| 2758 | 2758 |
| 2759 // Create indexed db. Again, it is enough to only simulate this by creating | 2759 // Create indexed db. Again, it is enough to only simulate this by creating |
| 2760 // the file on the disk. | 2760 // the file on the disk. |
| 2761 IndexedDBContext* idb_context = | 2761 IndexedDBContext* idb_context = |
| 2762 profile_->GetWebKitContext()->indexed_db_context(); | 2762 profile_->GetWebKitContext()->indexed_db_context(); |
| 2763 FilePath idb_path = idb_context->GetIndexedDBFilePath(origin_id); | 2763 FilePath idb_path = idb_context->GetIndexedDBFilePath(origin_id); |
| 2764 EXPECT_TRUE(file_util::CreateDirectory(idb_path.DirName())); | 2764 EXPECT_TRUE(file_util::CreateDirectory(idb_path)); |
| 2765 EXPECT_EQ(0, file_util::WriteFile(idb_path, NULL, 0)); | 2765 EXPECT_TRUE(file_util::DirectoryExists(idb_path)); |
| 2766 EXPECT_TRUE(file_util::PathExists(idb_path)); | |
|
michaeln
2011/08/23 20:39:48
This test was never updated when switching from sq
| |
| 2767 | 2766 |
| 2768 // Uninstall the extension. | 2767 // Uninstall the extension. |
| 2769 service_->UninstallExtension(good_crx, false, NULL); | 2768 service_->UninstallExtension(good_crx, false, NULL); |
| 2770 loop_.RunAllPending(); | 2769 loop_.RunAllPending(); |
| 2771 | 2770 |
| 2772 // Check that the cookie is gone. | 2771 // Check that the cookie is gone. |
| 2773 cookie_monster->GetAllCookiesForURLAsync( | 2772 cookie_monster->GetAllCookiesForURLAsync( |
| 2774 ext_url, | 2773 ext_url, |
| 2775 base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback, | 2774 base::Bind(&ExtensionCookieCallback::GetAllCookiesCallback, |
| 2776 base::Unretained(&callback))); | 2775 base::Unretained(&callback))); |
| 2777 loop_.RunAllPending(); | 2776 loop_.RunAllPending(); |
| 2778 EXPECT_EQ(0U, callback.list_.size()); | 2777 EXPECT_EQ(0U, callback.list_.size()); |
| 2779 | 2778 |
| 2780 // The database should have vanished as well. | 2779 // The database should have vanished as well. |
| 2781 origins.clear(); | 2780 origins.clear(); |
| 2782 db_tracker->GetAllOriginsInfo(&origins); | 2781 db_tracker->GetAllOriginsInfo(&origins); |
| 2783 EXPECT_EQ(0U, origins.size()); | 2782 EXPECT_EQ(0U, origins.size()); |
| 2784 | 2783 |
| 2785 // Check that the LSO file has been removed. | 2784 // Check that the LSO file has been removed. |
| 2786 EXPECT_FALSE(file_util::PathExists(lso_path)); | 2785 EXPECT_FALSE(file_util::PathExists(lso_path)); |
| 2787 | 2786 |
| 2788 // Check if the indexed db has disappeared too. | 2787 // Check if the indexed db has disappeared too. |
| 2789 EXPECT_FALSE(file_util::PathExists(idb_path)); | 2788 EXPECT_FALSE(file_util::DirectoryExists(idb_path)); |
| 2790 } | 2789 } |
| 2791 | 2790 |
| 2792 // Tests loading single extensions (like --load-extension) | 2791 // Tests loading single extensions (like --load-extension) |
| 2793 TEST_F(ExtensionServiceTest, LoadExtension) { | 2792 TEST_F(ExtensionServiceTest, LoadExtension) { |
| 2794 InitializeEmptyExtensionService(); | 2793 InitializeEmptyExtensionService(); |
| 2795 | 2794 |
| 2796 FilePath ext1 = data_dir_ | 2795 FilePath ext1 = data_dir_ |
| 2797 .AppendASCII("good") | 2796 .AppendASCII("good") |
| 2798 .AppendASCII("Extensions") | 2797 .AppendASCII("Extensions") |
| 2799 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") | 2798 .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj") |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3875 ASSERT_FALSE(AddPendingSyncInstall()); | 3874 ASSERT_FALSE(AddPendingSyncInstall()); |
| 3876 | 3875 |
| 3877 // Wait for the external source to install. | 3876 // Wait for the external source to install. |
| 3878 WaitForCrxInstall(crx_path_, true); | 3877 WaitForCrxInstall(crx_path_, true); |
| 3879 ASSERT_TRUE(IsCrxInstalled()); | 3878 ASSERT_TRUE(IsCrxInstalled()); |
| 3880 | 3879 |
| 3881 // Now that the extension is installed, sync request should fail | 3880 // Now that the extension is installed, sync request should fail |
| 3882 // because the extension is already installed. | 3881 // because the extension is already installed. |
| 3883 ASSERT_FALSE(AddPendingSyncInstall()); | 3882 ASSERT_FALSE(AddPendingSyncInstall()); |
| 3884 } | 3883 } |
| OLD | NEW |