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

Side by Side Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc

Issue 2734113006: "Bootstrap" a toolkit-views Typography spec. (Closed)
Patch Set: Rebase (conflict in layout_delegate.h due to r457774) Created 3 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
OLDNEW
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "apps/saved_files_service.h" 10 #include "apps/saved_files_service.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/extensions/test_extension_system.h" 14 #include "chrome/browser/extensions/test_extension_system.h"
15 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 17 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "extensions/common/extension_builder.h" 18 #include "extensions/common/extension_builder.h"
19 #include "extensions/common/manifest.h" 19 #include "extensions/common/manifest.h"
20 #include "extensions/common/permissions/permission_message_test_util.h" 20 #include "extensions/common/permissions/permission_message_test_util.h"
21 #include "extensions/common/permissions/permission_set.h" 21 #include "extensions/common/permissions/permission_set.h"
22 #include "extensions/common/permissions/permissions_data.h" 22 #include "extensions/common/permissions/permissions_data.h"
23 #include "testing/gmock/include/gmock/gmock-matchers.h" 23 #include "testing/gmock/include/gmock/gmock-matchers.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/views/test/test_views_delegate.h"
26 27
27 namespace { 28 namespace {
28 29
29 const char kTestExtensionId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; 30 const char kTestExtensionId[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
30 31
31 } // namespace 32 } // namespace
32 33
33 using base::FilePath; 34 using base::FilePath;
34 using testing::Contains; 35 using testing::Contains;
35 using testing::Eq; 36 using testing::Eq;
(...skipping 13 matching lines...) Expand all
49 .Set("scripts", extensions::ListBuilder() 50 .Set("scripts", extensions::ListBuilder()
50 .Append("background.js") 51 .Append("background.js")
51 .Build()) 52 .Build())
52 .Build()) 53 .Build())
53 .Build()) 54 .Build())
54 .Build(); 55 .Build();
55 } 56 }
56 57
57 // We need the UI thread in order to construct UI elements in the view. 58 // We need the UI thread in order to construct UI elements in the view.
58 content::TestBrowserThreadBundle thread_bundle_; 59 content::TestBrowserThreadBundle thread_bundle_;
59 TestingProfile profile_; 60 views::TestViewsDelegate views_delegate_;
61 TestingProfile profile_; // Needs BrowserThread::UI.
60 }; 62 };
61 63
62 // Tests that an app with no permissions is treated correctly. 64 // Tests that an app with no permissions is treated correctly.
63 TEST_F(AppInfoPermissionsPanelTest, NoPermissionsObtainedCorrectly) { 65 TEST_F(AppInfoPermissionsPanelTest, NoPermissionsObtainedCorrectly) {
64 scoped_refptr<const extensions::Extension> app = 66 scoped_refptr<const extensions::Extension> app =
65 extensions::ExtensionBuilder() 67 extensions::ExtensionBuilder()
66 .SetManifest(ValidAppManifest()) 68 .SetManifest(ValidAppManifest())
67 .SetID(kTestExtensionId) 69 .SetID(kTestExtensionId)
68 .Build(); 70 .Build();
69 AppInfoPermissionsPanel panel(&profile_, app.get()); 71 AppInfoPermissionsPanel panel(&profile_, app.get());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const std::vector<base::string16> retained_file_paths = 171 const std::vector<base::string16> retained_file_paths =
170 panel.GetRetainedFilePaths(); 172 panel.GetRetainedFilePaths();
171 ASSERT_EQ(3U, retained_file_paths.size()); 173 ASSERT_EQ(3U, retained_file_paths.size());
172 EXPECT_THAT(retained_file_paths, 174 EXPECT_THAT(retained_file_paths,
173 Contains(Eq(base::UTF8ToUTF16("file_1.ext")))); 175 Contains(Eq(base::UTF8ToUTF16("file_1.ext"))));
174 EXPECT_THAT(retained_file_paths, 176 EXPECT_THAT(retained_file_paths,
175 Contains(Eq(base::UTF8ToUTF16("file_2.ext")))); 177 Contains(Eq(base::UTF8ToUTF16("file_2.ext"))));
176 EXPECT_THAT(retained_file_paths, 178 EXPECT_THAT(retained_file_paths,
177 Contains(Eq(base::UTF8ToUTF16("file_3.ext")))); 179 Contains(Eq(base::UTF8ToUTF16("file_3.ext"))));
178 } 180 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698