OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/ui/website_settings/permission_bubble_browser_test_util
.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "base/memory/ptr_util.h" | |
9 #include "chrome/browser/extensions/extension_browsertest.h" | |
10 #include "chrome/browser/permissions/mock_permission_request.h" | |
11 #include "chrome/browser/ui/browser.h" | |
12 #include "chrome/browser/ui/browser_finder.h" | |
13 #include "chrome/browser/ui/browser_window.h" | |
14 #include "chrome/browser/ui/extensions/app_launch_params.h" | |
15 #include "chrome/browser/ui/extensions/application_launch.h" | |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
17 #include "chrome/common/chrome_switches.h" | |
18 #include "chrome/grit/generated_resources.h" | |
19 #include "ui/base/l10n/l10n_util.h" | |
20 | |
21 TestPermissionBubbleViewDelegate::TestPermissionBubbleViewDelegate() | |
22 : PermissionPrompt::Delegate() { | |
23 } | |
24 | |
25 PermissionBubbleBrowserTest::PermissionBubbleBrowserTest() { | |
26 } | |
27 | |
28 PermissionBubbleBrowserTest::~PermissionBubbleBrowserTest() { | |
29 } | |
30 | |
31 void PermissionBubbleBrowserTest::SetUpOnMainThread() { | |
32 ExtensionBrowserTest::SetUpOnMainThread(); | |
33 | |
34 // Add a single permission request. | |
35 requests_.push_back(base::MakeUnique<MockPermissionRequest>( | |
36 "Request 1", l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW), | |
37 l10n_util::GetStringUTF8(IDS_PERMISSION_DENY))); | |
38 } | |
39 | |
40 Browser* PermissionBubbleBrowserTest::OpenExtensionAppWindow() { | |
41 auto* extension = | |
42 LoadExtension(test_data_dir_.AppendASCII("app_with_panel_container/")); | |
43 CHECK(extension); | |
44 | |
45 AppLaunchParams params( | |
46 browser()->profile(), extension, extensions::LAUNCH_CONTAINER_PANEL, | |
47 WindowOpenDisposition::NEW_WINDOW, extensions::SOURCE_TEST); | |
48 | |
49 content::WebContents* app_window = OpenApplication(params); | |
50 CHECK(app_window); | |
51 | |
52 Browser* app_browser = chrome::FindBrowserWithWebContents(app_window); | |
53 CHECK(app_browser); | |
54 CHECK(app_browser->is_app()); | |
55 | |
56 return app_browser; | |
57 } | |
58 | |
59 std::vector<PermissionRequest*> PermissionBubbleBrowserTest::requests() { | |
60 std::vector<PermissionRequest*> result; | |
61 for (const auto& request : requests_) | |
62 result.push_back(request.get()); | |
63 return result; | |
64 } | |
65 | |
66 PermissionBubbleKioskBrowserTest::PermissionBubbleKioskBrowserTest() { | |
67 } | |
68 | |
69 PermissionBubbleKioskBrowserTest::~PermissionBubbleKioskBrowserTest() { | |
70 } | |
71 | |
72 void PermissionBubbleKioskBrowserTest::SetUpCommandLine( | |
73 base::CommandLine* command_line) { | |
74 PermissionBubbleBrowserTest::SetUpCommandLine(command_line); | |
75 command_line->AppendSwitch(switches::kKioskMode); | |
76 } | |
OLD | NEW |