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 "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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "chrome/test/base/testing_profile.h" | 62 #include "chrome/test/base/testing_profile.h" |
63 #include "content/browser/appcache/chrome_appcache_service.h" | 63 #include "content/browser/appcache/chrome_appcache_service.h" |
64 #include "content/browser/file_system/browser_file_system_helper.h" | 64 #include "content/browser/file_system/browser_file_system_helper.h" |
65 #include "content/browser/in_process_webkit/dom_storage_context.h" | 65 #include "content/browser/in_process_webkit/dom_storage_context.h" |
66 #include "content/browser/in_process_webkit/webkit_context.h" | 66 #include "content/browser/in_process_webkit/webkit_context.h" |
67 #include "content/public/browser/notification_registrar.h" | 67 #include "content/public/browser/notification_registrar.h" |
68 #include "content/public/browser/notification_service.h" | 68 #include "content/public/browser/notification_service.h" |
69 #include "content/public/browser/plugin_service.h" | 69 #include "content/public/browser/plugin_service.h" |
70 #include "content/test/test_browser_thread.h" | 70 #include "content/test/test_browser_thread.h" |
71 #include "googleurl/src/gurl.h" | 71 #include "googleurl/src/gurl.h" |
| 72 #include "grit/browser_resources.h" |
72 #include "net/base/cookie_monster.h" | 73 #include "net/base/cookie_monster.h" |
73 #include "net/base/cookie_options.h" | 74 #include "net/base/cookie_options.h" |
74 #include "net/url_request/url_request_context.h" | 75 #include "net/url_request/url_request_context.h" |
75 #include "net/url_request/url_request_context_getter.h" | 76 #include "net/url_request/url_request_context_getter.h" |
76 #include "testing/gtest/include/gtest/gtest.h" | 77 #include "testing/gtest/include/gtest/gtest.h" |
77 #include "testing/platform_test.h" | 78 #include "testing/platform_test.h" |
78 #include "webkit/database/database_tracker.h" | 79 #include "webkit/database/database_tracker.h" |
79 #include "webkit/database/database_util.h" | 80 #include "webkit/database/database_util.h" |
80 #include "webkit/plugins/npapi/mock_plugin_list.h" | 81 #include "webkit/plugins/npapi/mock_plugin_list.h" |
81 #include "webkit/quota/quota_manager.h" | 82 #include "webkit/quota/quota_manager.h" |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2030 // Now try updating to v2. | 2031 // Now try updating to v2. |
2031 UpdateExtension(id, extensions_path.AppendASCII("v2.crx"), ENABLED); | 2032 UpdateExtension(id, extensions_path.AppendASCII("v2.crx"), ENABLED); |
2032 ASSERT_EQ(std::string("2"), | 2033 ASSERT_EQ(std::string("2"), |
2033 service_->GetExtensionById(id, false)->version()->GetString()); | 2034 service_->GetExtensionById(id, false)->version()->GetString()); |
2034 | 2035 |
2035 // Verify that the ordinals match. | 2036 // Verify that the ordinals match. |
2036 ASSERT_TRUE(new_page_ordinal.Equal(sorting->GetPageOrdinal(id))); | 2037 ASSERT_TRUE(new_page_ordinal.Equal(sorting->GetPageOrdinal(id))); |
2037 ASSERT_TRUE(new_launch_ordinal.Equal(sorting->GetAppLaunchOrdinal(id))); | 2038 ASSERT_TRUE(new_launch_ordinal.Equal(sorting->GetAppLaunchOrdinal(id))); |
2038 } | 2039 } |
2039 | 2040 |
| 2041 // Ensures that the CWS has properly initialized ordinals. |
| 2042 TEST_F(ExtensionServiceTest, EnsureCWSOrdinalsInitialized) { |
| 2043 InitializeEmptyExtensionService(); |
| 2044 service_->component_loader()->Add(IDR_WEBSTORE_MANIFEST, |
| 2045 FilePath(FILE_PATH_LITERAL("web_store"))); |
| 2046 service_->Init(); |
| 2047 |
| 2048 |
| 2049 ExtensionSorting* sorting = service_->extension_prefs()->extension_sorting(); |
| 2050 EXPECT_TRUE( |
| 2051 sorting->GetPageOrdinal(extension_misc::kWebStoreAppId).IsValid()); |
| 2052 EXPECT_TRUE( |
| 2053 sorting->GetAppLaunchOrdinal(extension_misc::kWebStoreAppId).IsValid()); |
| 2054 } |
| 2055 |
2040 TEST_F(ExtensionServiceTest, InstallAppsWithUnlimitedStorage) { | 2056 TEST_F(ExtensionServiceTest, InstallAppsWithUnlimitedStorage) { |
2041 InitializeEmptyExtensionService(); | 2057 InitializeEmptyExtensionService(); |
2042 InitializeRequestContext(); | 2058 InitializeRequestContext(); |
2043 EXPECT_TRUE(service_->extensions()->is_empty()); | 2059 EXPECT_TRUE(service_->extensions()->is_empty()); |
2044 | 2060 |
2045 int pref_count = 0; | 2061 int pref_count = 0; |
2046 | 2062 |
2047 // Install app1 with unlimited storage. | 2063 // Install app1 with unlimited storage. |
2048 const Extension* extension = | 2064 const Extension* extension = |
2049 PackAndInstallCRX(data_dir_.AppendASCII("app1"), INSTALL_NEW); | 2065 PackAndInstallCRX(data_dir_.AppendASCII("app1"), INSTALL_NEW); |
(...skipping 2738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4788 ASSERT_FALSE(AddPendingSyncInstall()); | 4804 ASSERT_FALSE(AddPendingSyncInstall()); |
4789 | 4805 |
4790 // Wait for the external source to install. | 4806 // Wait for the external source to install. |
4791 WaitForCrxInstall(crx_path_, INSTALL_NEW); | 4807 WaitForCrxInstall(crx_path_, INSTALL_NEW); |
4792 ASSERT_TRUE(IsCrxInstalled()); | 4808 ASSERT_TRUE(IsCrxInstalled()); |
4793 | 4809 |
4794 // Now that the extension is installed, sync request should fail | 4810 // Now that the extension is installed, sync request should fail |
4795 // because the extension is already installed. | 4811 // because the extension is already installed. |
4796 ASSERT_FALSE(AddPendingSyncInstall()); | 4812 ASSERT_FALSE(AddPendingSyncInstall()); |
4797 } | 4813 } |
OLD | NEW |