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

Unified Diff: chrome/browser/ui/views/aura/app_list/app_list_model_unittest.cc

Issue 8890049: [Aura] Implement views-based applist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased and address comments in #2 Created 9 years 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
Index: chrome/browser/ui/views/aura/app_list/app_list_model_unittest.cc
diff --git a/chrome/browser/ui/views/aura/app_list/app_list_model_unittest.cc b/chrome/browser/ui/views/aura/app_list/app_list_model_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e4181022c3a1d83b9aca2ffe96a1d19bc214d66
--- /dev/null
+++ b/chrome/browser/ui/views/aura/app_list/app_list_model_unittest.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/file_util.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/views/aura/app_list/app_list_model.h"
+#include "chrome/browser/extensions/extension_service_unittest.h"
+#include "chrome/test/base/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/aura_shell/app_list/app_list_item_group_model.h"
+#include "ui/aura_shell/app_list/app_list_item_model.h"
+
+class AppListModelTest : public ExtensionServiceTestBase {
+ public:
+ AppListModelTest() {}
+ virtual ~AppListModelTest() {}
+};
+
+TEST_F(AppListModelTest, GetExtensionApps) {
+ // Load "app_list" extensions test profile. The test profile has 4 extensions:
+ // 1 dummy extension, 2 packaged extension apps and 1 hosted extension app.
+ FilePath source_install_dir = data_dir_
+ .AppendASCII("app_list")
+ .AppendASCII("Extensions");
+ FilePath pref_path = source_install_dir
+ .DirName()
+ .AppendASCII("Preferences");
+ InitializeInstalledExtensionService(pref_path, source_install_dir);
+ service_->Init();
+
+ // There should be 4 extensions in the test profile.
+ const ExtensionSet* extensions = service_->extensions();
+ ASSERT_EQ(static_cast<size_t>(4), extensions->size());
+
+ scoped_ptr<AppListModel> model(new AppListModel(profile_.get()));
+ model->GetExtensionApps();
+
+ // Expect to have two app groups.
+ EXPECT_EQ(2, model->item_count());
+
+ // Two packaged apps are on the first page and hosted app on the 2nd page.
+ aura_shell::AppListItemGroupModel* group1 = model->item_at(0);
+ EXPECT_EQ("Packaged App 1", group1->GetItem(0)->title());
+ EXPECT_EQ("Packaged App 2", group1->GetItem(1)->title());
+
+ aura_shell::AppListItemGroupModel* group2 = model->item_at(1);
+ EXPECT_EQ("Hosted App", group2->GetItem(0)->title());
+}

Powered by Google App Engine
This is Rietveld 408576698