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/ui/app_list/extension_app_model_builder.h" | 5 #include "chrome/browser/ui/app_list/extension_app_model_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 extensions::AppSorting* sorting = | 283 extensions::AppSorting* sorting = |
284 extensions::ExtensionPrefs::Get(profile_.get())->app_sorting(); | 284 extensions::ExtensionPrefs::Get(profile_.get())->app_sorting(); |
285 sorting->ClearOrdinals(kPackagedApp1Id); | 285 sorting->ClearOrdinals(kPackagedApp1Id); |
286 | 286 |
287 // Creates a corrupted ordinal case. | 287 // Creates a corrupted ordinal case. |
288 extensions::ExtensionScopedPrefs* scoped_prefs = | 288 extensions::ExtensionScopedPrefs* scoped_prefs = |
289 extensions::ExtensionPrefs::Get(profile_.get()); | 289 extensions::ExtensionPrefs::Get(profile_.get()); |
290 scoped_prefs->UpdateExtensionPref( | 290 scoped_prefs->UpdateExtensionPref( |
291 kHostedAppId, | 291 kHostedAppId, |
292 "page_ordinal", | 292 "page_ordinal", |
293 base::Value::CreateStringValue("a corrupted ordinal")); | 293 new base::StringValue("a corrupted ordinal")); |
294 | 294 |
295 // This should not assert or crash. | 295 // This should not assert or crash. |
296 CreateBuilder(); | 296 CreateBuilder(); |
297 } | 297 } |
298 | 298 |
299 TEST_F(ExtensionAppModelBuilderTest, OrdinalConfilicts) { | 299 TEST_F(ExtensionAppModelBuilderTest, OrdinalConfilicts) { |
300 // Creates conflict ordinals for app1 and app2. | 300 // Creates conflict ordinals for app1 and app2. |
301 syncer::StringOrdinal conflict_ordinal = | 301 syncer::StringOrdinal conflict_ordinal = |
302 syncer::StringOrdinal::CreateInitialOrdinal(); | 302 syncer::StringOrdinal::CreateInitialOrdinal(); |
303 | 303 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 extensions::Extension::WAS_INSTALLED_BY_DEFAULT | | 339 extensions::Extension::WAS_INSTALLED_BY_DEFAULT | |
340 extensions::Extension::FROM_BOOKMARK, | 340 extensions::Extension::FROM_BOOKMARK, |
341 kAppId, | 341 kAppId, |
342 &err); | 342 &err); |
343 EXPECT_TRUE(err.empty()); | 343 EXPECT_TRUE(err.empty()); |
344 | 344 |
345 service_->AddExtension(bookmark_app.get()); | 345 service_->AddExtension(bookmark_app.get()); |
346 EXPECT_EQ(kDefaultAppCount + 1, model_->top_level_item_list()->item_count()); | 346 EXPECT_EQ(kDefaultAppCount + 1, model_->top_level_item_list()->item_count()); |
347 EXPECT_NE(std::string::npos, GetModelContent(model_.get()).find(kAppName)); | 347 EXPECT_NE(std::string::npos, GetModelContent(model_.get()).find(kAppName)); |
348 } | 348 } |
OLD | NEW |