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 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 // explicitly. It will never get invoked. | 35 // explicitly. It will never get invoked. |
36 Manifest(const Manifest& m); | 36 Manifest(const Manifest& m); |
37 | 37 |
38 ~Manifest(); | 38 ~Manifest(); |
39 | 39 |
40 const std::string& name() const { return name_; }; | 40 const std::string& name() const { return name_; }; |
41 | 41 |
42 base::DictionaryValue* GetManifest(char const* test_data_dir, | 42 base::DictionaryValue* GetManifest(char const* test_data_dir, |
43 std::string* error) const; | 43 std::string* error) const; |
44 | 44 |
45 private: | 45 protected: |
46 const std::string name_; | 46 const std::string name_; |
47 mutable base::DictionaryValue* manifest_; | 47 mutable base::DictionaryValue* manifest_; |
48 mutable scoped_ptr<base::DictionaryValue> manifest_holder_; | 48 mutable scoped_ptr<base::DictionaryValue> manifest_holder_; |
49 }; | 49 }; |
50 | 50 |
51 // Helper class creating a Manifest object from a string. For readability | |
52 // single quotes are replaced with double quotes. | |
53 // E.g. ManifestFromString("{ 'name': 'a' }") parses JSON { "name": "a" }. | |
54 class ManifestFromString : public Manifest { | |
Jeffrey Yasskin
2014/02/28 01:54:37
It'd be nice to make this Just Work for Manifest,
scheib
2014/02/28 04:16:07
Constructor overloaded would be nice - but I don't
| |
55 public: | |
56 explicit ManifestFromString( | |
57 const char* manifest_as_string_with_single_quotes); | |
58 ~ManifestFromString(); | |
59 | |
60 protected: | |
61 scoped_ptr<base::Value> parsed_manifest_holder_; | |
62 }; | |
63 | |
51 // The subdirectory in which to find test data files. | 64 // The subdirectory in which to find test data files. |
52 virtual char const* test_data_dir(); | 65 virtual char const* test_data_dir(); |
53 | 66 |
54 scoped_ptr<base::DictionaryValue> LoadManifest( | 67 scoped_ptr<base::DictionaryValue> LoadManifest( |
55 char const* manifest_name, | 68 char const* manifest_name, |
56 std::string* error); | 69 std::string* error); |
57 | 70 |
58 scoped_refptr<extensions::Extension> LoadExtension( | 71 scoped_refptr<extensions::Extension> LoadExtension( |
59 const Manifest& manifest, | 72 const Manifest& manifest, |
60 std::string* error, | 73 std::string* error, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 // Force the manifest tests to run as though they are on trunk, since several | 158 // Force the manifest tests to run as though they are on trunk, since several |
146 // tests rely on manifest features being available that aren't on | 159 // tests rely on manifest features being available that aren't on |
147 // stable/beta. | 160 // stable/beta. |
148 // | 161 // |
149 // These objects nest, so if a test wants to explicitly test the behaviour | 162 // These objects nest, so if a test wants to explicitly test the behaviour |
150 // on stable or beta, declare it inside that test. | 163 // on stable or beta, declare it inside that test. |
151 extensions::ScopedCurrentChannel current_channel_; | 164 extensions::ScopedCurrentChannel current_channel_; |
152 }; | 165 }; |
153 | 166 |
154 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ | 167 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ |
OLD | NEW |