| 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/apps_model_builder.h" | 5 #include "chrome/browser/ui/app_list/apps_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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 GetModelContent(model.get())); | 97 GetModelContent(model.get())); |
| 98 } | 98 } |
| 99 | 99 |
| 100 TEST_F(AppsModelBuilderTest, HideWebStore) { | 100 TEST_F(AppsModelBuilderTest, HideWebStore) { |
| 101 // Install a "web store" app. | 101 // Install a "web store" app. |
| 102 scoped_refptr<extensions::Extension> store = | 102 scoped_refptr<extensions::Extension> store = |
| 103 MakeApp("webstore", | 103 MakeApp("webstore", |
| 104 "0.0", | 104 "0.0", |
| 105 "http://google.com", | 105 "http://google.com", |
| 106 std::string(extension_misc::kWebStoreAppId)); | 106 std::string(extension_misc::kWebStoreAppId)); |
| 107 service_->AddExtension(store); | 107 service_->AddExtension(store.get()); |
| 108 | 108 |
| 109 // Install an "enterprise web store" app. | 109 // Install an "enterprise web store" app. |
| 110 scoped_refptr<extensions::Extension> enterprise_store = | 110 scoped_refptr<extensions::Extension> enterprise_store = |
| 111 MakeApp("enterprise_webstore", | 111 MakeApp("enterprise_webstore", |
| 112 "0.0", | 112 "0.0", |
| 113 "http://google.com", | 113 "http://google.com", |
| 114 std::string(extension_misc::kEnterpriseWebStoreAppId)); | 114 std::string(extension_misc::kEnterpriseWebStoreAppId)); |
| 115 service_->AddExtension(enterprise_store); | 115 service_->AddExtension(enterprise_store.get()); |
| 116 | 116 |
| 117 // Web stores should be present in the AppListModel. | 117 // Web stores should be present in the AppListModel. |
| 118 app_list::AppListModel::Apps model1; | 118 app_list::AppListModel::Apps model1; |
| 119 AppsModelBuilder builder1(profile_.get(), &model1, NULL); | 119 AppsModelBuilder builder1(profile_.get(), &model1, NULL); |
| 120 builder1.Build(); | 120 builder1.Build(); |
| 121 std::string content = GetModelContent(&model1); | 121 std::string content = GetModelContent(&model1); |
| 122 EXPECT_NE(std::string::npos, content.find("webstore")); | 122 EXPECT_NE(std::string::npos, content.find("webstore")); |
| 123 EXPECT_NE(std::string::npos, content.find("enterprise_webstore")); | 123 EXPECT_NE(std::string::npos, content.find("enterprise_webstore")); |
| 124 | 124 |
| 125 // Activate the HideWebStoreIcon policy. | 125 // Activate the HideWebStoreIcon policy. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 253 |
| 254 // By default, conflicted items are sorted by their app ids. | 254 // By default, conflicted items are sorted by their app ids. |
| 255 EXPECT_EQ(std::string("Hosted App,Packaged App 1,Packaged App 2"), | 255 EXPECT_EQ(std::string("Hosted App,Packaged App 1,Packaged App 2"), |
| 256 GetModelContent(model.get())); | 256 GetModelContent(model.get())); |
| 257 | 257 |
| 258 // Move hosted app between app1 and app2 and it should not crash. | 258 // Move hosted app between app1 and app2 and it should not crash. |
| 259 service_->OnExtensionMoved(kHostedAppId, kPackagedApp1Id, kPackagedApp2Id); | 259 service_->OnExtensionMoved(kHostedAppId, kPackagedApp1Id, kPackagedApp2Id); |
| 260 EXPECT_EQ(std::string("Packaged App 1,Hosted App,Packaged App 2"), | 260 EXPECT_EQ(std::string("Packaged App 1,Hosted App,Packaged App 2"), |
| 261 GetModelContent(model.get())); | 261 GetModelContent(model.get())); |
| 262 } | 262 } |
| OLD | NEW |