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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_service_unittest.h" | 12 #include "chrome/browser/extensions/extension_service_unittest.h" |
12 #include "chrome/browser/extensions/permissions_updater.h" | 13 #include "chrome/browser/extensions/permissions_updater.h" |
13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
16 #include "chrome/common/extensions/permissions/permission_set.h" | 17 #include "chrome/common/extensions/permissions/permission_set.h" |
17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
18 #include "chrome/test/base/ui_test_utils.h" | |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 | 23 |
24 namespace extensions { | 24 namespace extensions { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // A helper class that listens for NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED. | 28 // A helper class that listens for NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED. |
(...skipping 11 matching lines...) Expand all Loading... |
40 waiting_ = false; | 40 waiting_ = false; |
41 extension_ = NULL; | 41 extension_ = NULL; |
42 permissions_ = NULL; | 42 permissions_ = NULL; |
43 } | 43 } |
44 | 44 |
45 void Wait() { | 45 void Wait() { |
46 if (received_notification_) | 46 if (received_notification_) |
47 return; | 47 return; |
48 | 48 |
49 waiting_ = true; | 49 waiting_ = true; |
50 ui_test_utils::RunMessageLoop(); | 50 base::RunLoop run_loop; |
| 51 run_loop.Run(); |
51 } | 52 } |
52 | 53 |
53 bool received_notification() const { return received_notification_; } | 54 bool received_notification() const { return received_notification_; } |
54 const Extension* extension() const { return extension_; } | 55 const Extension* extension() const { return extension_; } |
55 const PermissionSet* permissions() const { return permissions_; } | 56 const PermissionSet* permissions() const { return permissions_; } |
56 UpdatedExtensionPermissionsInfo::Reason reason() const { | 57 UpdatedExtensionPermissionsInfo::Reason reason() const { |
57 return reason_; | 58 return reason_; |
58 } | 59 } |
59 | 60 |
60 private: | 61 private: |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 // Verify that the extension prefs hold the new active permissions and the | 202 // Verify that the extension prefs hold the new active permissions and the |
202 // same granted permissions. | 203 // same granted permissions. |
203 from_prefs = prefs->GetActivePermissions(extension->id()); | 204 from_prefs = prefs->GetActivePermissions(extension->id()); |
204 ASSERT_EQ(*active_permissions, *from_prefs); | 205 ASSERT_EQ(*active_permissions, *from_prefs); |
205 | 206 |
206 from_prefs = prefs->GetGrantedPermissions(extension->id()); | 207 from_prefs = prefs->GetGrantedPermissions(extension->id()); |
207 ASSERT_EQ(*granted_permissions, *from_prefs); | 208 ASSERT_EQ(*granted_permissions, *from_prefs); |
208 } | 209 } |
209 | 210 |
210 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |