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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifest_test.h

Issue 178253007: Parse manifest file with app.service_worker.script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 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"
11 #include "chrome/common/extensions/features/feature_channel.h" 11 #include "chrome/common/extensions/features/feature_channel.h"
12 #include "extensions/common/extension.h" 12 #include "extensions/common/extension.h"
13 #include "extensions/common/manifest.h" 13 #include "extensions/common/manifest.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 class ExtensionManifestTest : public testing::Test { 16 class ExtensionManifestTest : public testing::Test {
17 public: 17 public:
18 ExtensionManifestTest(); 18 ExtensionManifestTest();
19 19
20 protected: 20 protected:
21 // Helper class that simplifies creating methods that take either a filename 21 // Helper class that simplifies creating methods that take either a filename
22 // to a manifest or the manifest itself. 22 // to a manifest or the manifest itself.
23 class Manifest { 23 class Manifest {
24 public: 24 public:
25 explicit Manifest(const char* name); 25 explicit Manifest(const char* name);
26 Manifest(base::DictionaryValue* manifest, const char* name); 26 Manifest(base::DictionaryValue* manifest, const char* name);
27 Manifest(scoped_ptr<base::DictionaryValue> manifest, const char* name);
Jeffrey Yasskin 2014/03/04 01:41:48 All of the uses of this constructor pass "" for th
scheib 2014/03/04 15:34:31 Done.
27 // C++98 requires the copy constructor for a type to be visible if you 28 // C++98 requires the copy constructor for a type to be visible if you
28 // take a const-ref of a temporary for that type. Since Manifest 29 // take a const-ref of a temporary for that type. Since Manifest
29 // contains a scoped_ptr, its implicit copy constructor is declared 30 // contains a scoped_ptr, its implicit copy constructor is declared
30 // Manifest(Manifest&) according to spec 12.8.5. This breaks the first 31 // Manifest(Manifest&) according to spec 12.8.5. This breaks the first
31 // requirement and thus you cannot use it with LoadAndExpectError() or 32 // requirement and thus you cannot use it with LoadAndExpectError() or
32 // LoadAndExpectSuccess() easily. 33 // LoadAndExpectSuccess() easily.
33 // 34 //
34 // To get around this spec pedantry, we declare the copy constructor 35 // To get around this spec pedantry, we declare the copy constructor
35 // explicitly. It will never get invoked. 36 // explicitly. It will never get invoked.
36 Manifest(const Manifest& m); 37 Manifest(const Manifest& m);
37 38
38 ~Manifest(); 39 ~Manifest();
39 40
40 const std::string& name() const { return name_; }; 41 const std::string& name() const { return name_; };
41 42
42 base::DictionaryValue* GetManifest(char const* test_data_dir, 43 base::DictionaryValue* GetManifest(char const* test_data_dir,
43 std::string* error) const; 44 std::string* error) const;
44 45
45 private: 46 protected:
Jeffrey Yasskin 2014/03/04 01:41:48 I think this can go back to "private".
scheib 2014/03/04 15:34:31 Done.
46 const std::string name_; 47 const std::string name_;
47 mutable base::DictionaryValue* manifest_; 48 mutable base::DictionaryValue* manifest_;
48 mutable scoped_ptr<base::DictionaryValue> manifest_holder_; 49 mutable scoped_ptr<base::DictionaryValue> manifest_holder_;
49 }; 50 };
50 51
51 // The subdirectory in which to find test data files. 52 // The subdirectory in which to find test data files.
52 virtual char const* test_data_dir(); 53 virtual char const* test_data_dir();
53 54
54 scoped_ptr<base::DictionaryValue> LoadManifest( 55 scoped_ptr<base::DictionaryValue> LoadManifest(
55 char const* manifest_name, 56 char const* manifest_name,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 // Force the manifest tests to run as though they are on trunk, since several 146 // 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 147 // tests rely on manifest features being available that aren't on
147 // stable/beta. 148 // stable/beta.
148 // 149 //
149 // These objects nest, so if a test wants to explicitly test the behaviour 150 // These objects nest, so if a test wants to explicitly test the behaviour
150 // on stable or beta, declare it inside that test. 151 // on stable or beta, declare it inside that test.
151 extensions::ScopedCurrentChannel current_channel_; 152 extensions::ScopedCurrentChannel current_channel_;
152 }; 153 };
153 154
154 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_ 155 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_TESTS_EXTENSION_MANIFEST_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698