OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/json/json_file_value_serializer.h" | 5 #include "base/json/json_file_value_serializer.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
10 #include "extensions/browser/info_map.h" | 10 #include "extensions/browser/info_map.h" |
11 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
12 #include "extensions/common/manifest_constants.h" | 12 #include "extensions/common/manifest_constants.h" |
13 #include "extensions/common/permissions/permissions_data.h" | 13 #include "extensions/common/permissions/permissions_data.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using content::BrowserThread; | 16 using content::BrowserThread; |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 namespace { | 19 namespace { |
20 | 20 |
21 scoped_refptr<Extension> LoadManifest(const std::string& dir, | 21 scoped_refptr<Extension> LoadManifest(const std::string& dir, |
22 const std::string& test_file) { | 22 const std::string& test_file) { |
23 base::FilePath path; | 23 base::FilePath path; |
24 PathService::Get(chrome::DIR_TEST_DATA, &path); | 24 PathService::Get(chrome::DIR_TEST_DATA, &path); |
25 path = path.AppendASCII("extensions").AppendASCII(dir).AppendASCII(test_file); | 25 path = path.AppendASCII("extensions").AppendASCII(dir).AppendASCII(test_file); |
26 | 26 |
27 JSONFileValueDeserializer deserializer(path); | 27 JSONFileValueDeserializer deserializer(path); |
28 scoped_ptr<base::Value> result = deserializer.Deserialize(NULL, NULL); | 28 std::unique_ptr<base::Value> result = deserializer.Deserialize(NULL, NULL); |
29 if (!result) | 29 if (!result) |
30 return NULL; | 30 return NULL; |
31 | 31 |
32 std::string error; | 32 std::string error; |
33 scoped_refptr<Extension> extension = | 33 scoped_refptr<Extension> extension = |
34 Extension::Create(path, | 34 Extension::Create(path, |
35 Manifest::INVALID_LOCATION, | 35 Manifest::INVALID_LOCATION, |
36 *static_cast<base::DictionaryValue*>(result.get()), | 36 *static_cast<base::DictionaryValue*>(result.get()), |
37 Extension::NO_FLAGS, | 37 Extension::NO_FLAGS, |
38 &error); | 38 &error); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 LoadManifest("manifest_tests", "valid_app.json")); | 109 LoadManifest("manifest_tests", "valid_app.json")); |
110 info_map->AddExtension(app.get(), base::Time(), false, false); | 110 info_map->AddExtension(app.get(), base::Time(), false, false); |
111 | 111 |
112 EXPECT_FALSE(info_map->AreNotificationsDisabled(app->id())); | 112 EXPECT_FALSE(info_map->AreNotificationsDisabled(app->id())); |
113 info_map->SetNotificationsDisabled(app->id(), true); | 113 info_map->SetNotificationsDisabled(app->id(), true); |
114 EXPECT_TRUE(info_map->AreNotificationsDisabled(app->id())); | 114 EXPECT_TRUE(info_map->AreNotificationsDisabled(app->id())); |
115 info_map->SetNotificationsDisabled(app->id(), false); | 115 info_map->SetNotificationsDisabled(app->id(), false); |
116 } | 116 } |
117 | 117 |
118 } // namespace extensions | 118 } // namespace extensions |
OLD | NEW |