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

Side by Side Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 6378009: Only allow extension pages to be displayed in the sidebar to be consistent... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 CommandLine::ForCurrentProcess()->AppendSwitch( 281 CommandLine::ForCurrentProcess()->AppendSwitch(
282 switches::kEnableExperimentalExtensionApis); 282 switches::kEnableExperimentalExtensionApis);
283 283
284 LoadAndExpectError("sidebar_no_permissions.json", 284 LoadAndExpectError("sidebar_no_permissions.json",
285 errors::kSidebarExperimental); 285 errors::kSidebarExperimental);
286 286
287 LoadAndExpectError("sidebar_icon_empty.json", 287 LoadAndExpectError("sidebar_icon_empty.json",
288 errors::kInvalidSidebarDefaultIconPath); 288 errors::kInvalidSidebarDefaultIconPath);
289 LoadAndExpectError("sidebar_icon_invalid_type.json", 289 LoadAndExpectError("sidebar_icon_invalid_type.json",
290 errors::kInvalidSidebarDefaultIconPath); 290 errors::kInvalidSidebarDefaultIconPath);
291 LoadAndExpectError("sidebar_page_empty.json",
292 errors::kInvalidSidebarDefaultPage);
293 LoadAndExpectError("sidebar_page_invalid_type.json",
294 errors::kInvalidSidebarDefaultPage);
291 LoadAndExpectError("sidebar_title_invalid_type.json", 295 LoadAndExpectError("sidebar_title_invalid_type.json",
292 errors::kInvalidSidebarDefaultTitle); 296 errors::kInvalidSidebarDefaultTitle);
293 LoadAndExpectError("sidebar_url_invalid.json",
294 errors::kInvalidSidebarDefaultUrl);
295 LoadAndExpectError("sidebar_url_invalid_type.json",
296 errors::kInvalidSidebarDefaultUrl);
297 LoadAndExpectError("sidebar_url_no_permissions.json",
298 extension_manifest_errors::kCannotAccessPage);
299 297
300 scoped_refptr<Extension> extension(LoadAndExpectSuccess("sidebar.json")); 298 scoped_refptr<Extension> extension(LoadAndExpectSuccess("sidebar.json"));
301 ASSERT_TRUE(extension->sidebar_defaults() != NULL); 299 ASSERT_TRUE(extension->sidebar_defaults() != NULL);
302 EXPECT_EQ(extension->sidebar_defaults()->default_title(), 300 EXPECT_EQ(extension->sidebar_defaults()->default_title(),
303 ASCIIToUTF16("Default title")); 301 ASCIIToUTF16("Default title"));
304 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(), 302 EXPECT_EQ(extension->sidebar_defaults()->default_icon_path(),
305 "icon.png"); 303 "icon.png");
306 EXPECT_EQ(extension->url().spec() + "sidebar.html", 304 EXPECT_EQ(extension->url().spec() + "sidebar.html",
307 extension->sidebar_defaults()->default_url().spec()); 305 extension->sidebar_defaults()->default_page().spec());
308
309 scoped_refptr<Extension> extension_external_url(
310 LoadAndExpectSuccess("sidebar_external_url.json"));
311 EXPECT_EQ("http://sidebar.url/sidebar.html",
312 extension_external_url->sidebar_defaults()->default_url().spec());
313 306
314 *CommandLine::ForCurrentProcess() = old_command_line; 307 *CommandLine::ForCurrentProcess() = old_command_line;
315 } 308 }
316 309
317 TEST_F(ExtensionManifestTest, DisallowHybridApps) { 310 TEST_F(ExtensionManifestTest, DisallowHybridApps) {
318 LoadAndExpectError("disallow_hybrid_1.json", 311 LoadAndExpectError("disallow_hybrid_1.json",
319 errors::kHostedAppsCannotIncludeExtensionFeatures); 312 errors::kHostedAppsCannotIncludeExtensionFeatures);
320 LoadAndExpectError("disallow_hybrid_2.json", 313 LoadAndExpectError("disallow_hybrid_2.json",
321 errors::kHostedAppsCannotIncludeExtensionFeatures); 314 errors::kHostedAppsCannotIncludeExtensionFeatures);
322 } 315 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 extension_manifest_errors::kInvalidTtsVoicesGender); 437 extension_manifest_errors::kInvalidTtsVoicesGender);
445 438
446 scoped_refptr<Extension> extension( 439 scoped_refptr<Extension> extension(
447 LoadAndExpectSuccess("tts_provider_valid.json")); 440 LoadAndExpectSuccess("tts_provider_valid.json"));
448 441
449 ASSERT_EQ(1u, extension->tts_voices().size()); 442 ASSERT_EQ(1u, extension->tts_voices().size());
450 EXPECT_EQ("name", extension->tts_voices()[0].voice_name); 443 EXPECT_EQ("name", extension->tts_voices()[0].voice_name);
451 EXPECT_EQ("en-US", extension->tts_voices()[0].locale); 444 EXPECT_EQ("en-US", extension->tts_voices()[0].locale);
452 EXPECT_EQ("female", extension->tts_voices()[0].gender); 445 EXPECT_EQ("female", extension->tts_voices()[0].gender);
453 } 446 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_file_util.cc ('k') | chrome/common/extensions/extension_sidebar_defaults.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698