Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1791)

Unified Diff: chrome/browser/extensions/extension_sorting_unittest.cc

Issue 10068001: [NTP4] Fix empty apps page crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: estade review Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_sorting.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_sorting_unittest.cc
diff --git a/chrome/browser/extensions/extension_sorting_unittest.cc b/chrome/browser/extensions/extension_sorting_unittest.cc
index ed309f1ba2f507fae19992e730aee77162527280..ed16f6875ab984f8427ee63332e5b4a0686828dc 100644
--- a/chrome/browser/extensions/extension_sorting_unittest.cc
+++ b/chrome/browser/extensions/extension_sorting_unittest.cc
@@ -685,7 +685,7 @@ class ExtensionSortingGetMinOrMaxAppLaunchOrdinalsOnPage :
TEST_F(ExtensionSortingGetMinOrMaxAppLaunchOrdinalsOnPage,
ExtensionSortingGetMinOrMaxAppLaunchOrdinalsOnPage) {}
-// Make sure that empty pages aren't removes from the integer to ordinal
+// Make sure that empty pages aren't removed from the integer to ordinal
// mapping. See http://www.crbug.com/109802 for details.
class ExtensionSortingKeepEmptyStringOrdinalPages :
public ExtensionSortingPreinstalledAppsBase {
@@ -725,3 +725,35 @@ class ExtensionSortingKeepEmptyStringOrdinalPages :
};
TEST_F(ExtensionSortingKeepEmptyStringOrdinalPages,
ExtensionSortingKeepEmptyStringOrdinalPages) {}
+
+class ExtensionSortingMakesFillerOrdinals :
+ public ExtensionSortingPreinstalledAppsBase {
+ public:
+ ExtensionSortingMakesFillerOrdinals() {}
+ virtual ~ExtensionSortingMakesFillerOrdinals() {}
+
+ virtual void Initialize() {
+ ExtensionSorting* extension_sorting = prefs()->extension_sorting();
+
+ StringOrdinal first_page = StringOrdinal::CreateInitialOrdinal();
+ extension_sorting->SetPageOrdinal(app1_->id(), first_page);
+ EXPECT_EQ(0, extension_sorting->PageStringOrdinalAsInteger(first_page));
+ }
+ virtual void Verify() {
+ ExtensionSorting* extension_sorting = prefs()->extension_sorting();
+
+ // Because the UI can add an unlimited number of empty pages without an app
+ // on them, this test simulates dropping of an app on the 1st and 4th empty
+ // pages (3rd and 6th pages by index) to ensure we don't crash and that
+ // filler ordinals are created as needed. See: http://crbug.com/122214
+ StringOrdinal page_three = extension_sorting->PageIntegerAsStringOrdinal(2);
+ extension_sorting->SetPageOrdinal(app1_->id(), page_three);
+ EXPECT_EQ(2, extension_sorting->PageStringOrdinalAsInteger(page_three));
+
+ StringOrdinal page_six = extension_sorting->PageIntegerAsStringOrdinal(5);
+ extension_sorting->SetPageOrdinal(app1_->id(), page_six);
+ EXPECT_EQ(5, extension_sorting->PageStringOrdinalAsInteger(page_six));
+ }
+};
+TEST_F(ExtensionSortingMakesFillerOrdinals,
+ ExtensionSortingMakesFillerOrdinals) {}
« no previous file with comments | « chrome/browser/extensions/extension_sorting.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698