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/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 errors::kInvalidFileFiltersList); | 834 errors::kInvalidFileFiltersList); |
835 LoadAndExpectError("filebrowser_invalid_file_filters_2.json", | 835 LoadAndExpectError("filebrowser_invalid_file_filters_2.json", |
836 ExtensionErrorUtils::FormatErrorMessage( | 836 ExtensionErrorUtils::FormatErrorMessage( |
837 errors::kInvalidFileFilterValue, base::IntToString(0))); | 837 errors::kInvalidFileFilterValue, base::IntToString(0))); |
838 LoadAndExpectError("filebrowser_invalid_file_filters_url.json", | 838 LoadAndExpectError("filebrowser_invalid_file_filters_url.json", |
839 ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidURLPatternError, | 839 ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidURLPatternError, |
840 "http:*.html")); | 840 "http:*.html")); |
841 | 841 |
842 scoped_refptr<Extension> extension( | 842 scoped_refptr<Extension> extension( |
843 LoadAndExpectSuccess("filebrowser_valid.json")); | 843 LoadAndExpectSuccess("filebrowser_valid.json")); |
| 844 ASSERT_TRUE(extension.get()); |
844 ASSERT_TRUE(extension->file_browser_handlers() != NULL); | 845 ASSERT_TRUE(extension->file_browser_handlers() != NULL); |
845 ASSERT_EQ(extension->file_browser_handlers()->size(), 1U); | 846 ASSERT_EQ(extension->file_browser_handlers()->size(), 1U); |
846 const FileBrowserHandler* action = | 847 const FileBrowserHandler* action = |
847 extension->file_browser_handlers()->at(0).get(); | 848 extension->file_browser_handlers()->at(0).get(); |
848 EXPECT_EQ(action->title(), "Default title"); | 849 EXPECT_EQ(action->title(), "Default title"); |
849 EXPECT_EQ(action->icon_path(), "icon.png"); | 850 EXPECT_EQ(action->icon_path(), "icon.png"); |
850 const URLPatternSet& patterns = action->file_url_patterns(); | 851 const URLPatternSet& patterns = action->file_url_patterns(); |
851 ASSERT_EQ(patterns.patterns().size(), 1U); | 852 ASSERT_EQ(patterns.patterns().size(), 1U); |
852 ASSERT_TRUE(action->MatchesURL( | 853 ASSERT_TRUE(action->MatchesURL( |
853 GURL("filesystem:chrome-extension://foo/local/test.txt"))); | 854 GURL("filesystem:chrome-extension://foo/local/test.txt"))); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 EXPECT_EQ("", extension->page_action()->id()); | 979 EXPECT_EQ("", extension->page_action()->id()); |
979 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size()); | 980 EXPECT_EQ(0u, extension->page_action()->icon_paths()->size()); |
980 EXPECT_EQ("", extension->page_action()->GetTitle( | 981 EXPECT_EQ("", extension->page_action()->GetTitle( |
981 ExtensionAction::kDefaultTabId)); | 982 ExtensionAction::kDefaultTabId)); |
982 EXPECT_FALSE(extension->page_action()->HasPopup( | 983 EXPECT_FALSE(extension->page_action()->HasPopup( |
983 ExtensionAction::kDefaultTabId)); | 984 ExtensionAction::kDefaultTabId)); |
984 | 985 |
985 LoadAndExpectError("page_action_manifest_version_2b.json", | 986 LoadAndExpectError("page_action_manifest_version_2b.json", |
986 errors::kInvalidPageActionPopup); | 987 errors::kInvalidPageActionPopup); |
987 } | 988 } |
OLD | NEW |