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 "chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_pane
l.h" | 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_pane
l.h" |
6 | 6 |
7 #include "apps/saved_files_service.h" | 7 #include "apps/saved_files_service.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 .Set("manifest_version", 2) | 44 .Set("manifest_version", 2) |
45 .Set("app", | 45 .Set("app", |
46 extensions::DictionaryBuilder().Set( | 46 extensions::DictionaryBuilder().Set( |
47 "background", | 47 "background", |
48 extensions::DictionaryBuilder().Set( | 48 extensions::DictionaryBuilder().Set( |
49 "scripts", | 49 "scripts", |
50 extensions::ListBuilder().Append("background.js")))) | 50 extensions::ListBuilder().Append("background.js")))) |
51 .Build(); | 51 .Build(); |
52 } | 52 } |
53 | 53 |
54 TestingProfile profile_; | |
55 | |
56 // We need the UI thread in order to construct UI elements in the view. | 54 // We need the UI thread in order to construct UI elements in the view. |
57 content::TestBrowserThreadBundle thread_bundle_; | 55 content::TestBrowserThreadBundle thread_bundle_; |
| 56 TestingProfile profile_; |
58 }; | 57 }; |
59 | 58 |
60 // Tests that an app with no permissions is treated correctly. | 59 // Tests that an app with no permissions is treated correctly. |
61 TEST_F(AppInfoPermissionsPanelTest, NoPermissionsObtainedCorrectly) { | 60 TEST_F(AppInfoPermissionsPanelTest, NoPermissionsObtainedCorrectly) { |
62 scoped_refptr<const extensions::Extension> app = | 61 scoped_refptr<const extensions::Extension> app = |
63 extensions::ExtensionBuilder() | 62 extensions::ExtensionBuilder() |
64 .SetManifest(ValidAppManifest()) | 63 .SetManifest(ValidAppManifest()) |
65 .SetID(kTestExtensionId) | 64 .SetID(kTestExtensionId) |
66 .Build(); | 65 .Build(); |
67 AppInfoPermissionsPanel panel(&profile_, app.get()); | 66 AppInfoPermissionsPanel panel(&profile_, app.get()); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const std::vector<base::string16> retained_file_paths = | 154 const std::vector<base::string16> retained_file_paths = |
156 panel.GetRetainedFilePaths(); | 155 panel.GetRetainedFilePaths(); |
157 ASSERT_EQ(3U, retained_file_paths.size()); | 156 ASSERT_EQ(3U, retained_file_paths.size()); |
158 EXPECT_THAT(retained_file_paths, | 157 EXPECT_THAT(retained_file_paths, |
159 Contains(Eq(base::UTF8ToUTF16("file_1.ext")))); | 158 Contains(Eq(base::UTF8ToUTF16("file_1.ext")))); |
160 EXPECT_THAT(retained_file_paths, | 159 EXPECT_THAT(retained_file_paths, |
161 Contains(Eq(base::UTF8ToUTF16("file_2.ext")))); | 160 Contains(Eq(base::UTF8ToUTF16("file_2.ext")))); |
162 EXPECT_THAT(retained_file_paths, | 161 EXPECT_THAT(retained_file_paths, |
163 Contains(Eq(base::UTF8ToUTF16("file_3.ext")))); | 162 Contains(Eq(base::UTF8ToUTF16("file_3.ext")))); |
164 } | 163 } |
OLD | NEW |