OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
groby-ooo-7-16
2015/04/10 20:58:55
Move to c/b/ui/website_settings.
hcarmona
2015/04/10 22:28:05
Done.
| |
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/test/permission_bubble_browser_test_util.h" | |
6 | |
7 #include "base/command_line.h" | |
8 #include "chrome/browser/extensions/extension_browsertest.h" | |
9 #include "chrome/browser/ui/browser.h" | |
10 #include "chrome/browser/ui/browser_finder.h" | |
11 #include "chrome/browser/ui/browser_window.h" | |
12 #include "chrome/browser/ui/extensions/app_launch_params.h" | |
13 #include "chrome/browser/ui/extensions/application_launch.h" | |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
15 #include "chrome/browser/ui/website_settings/mock_permission_bubble_request.h" | |
16 #include "chrome/common/chrome_switches.h" | |
17 #include "chrome/grit/generated_resources.h" | |
18 #include "ui/base/l10n/l10n_util.h" | |
19 | |
20 TestPermissionBubbleViewDelegate::TestPermissionBubbleViewDelegate() | |
21 : PermissionBubbleView::Delegate() { | |
22 } | |
23 | |
24 PermissionBubbleBrowsertest::PermissionBubbleBrowsertest() | |
25 : ExtensionBrowserTest() { | |
26 } | |
27 | |
28 PermissionBubbleBrowsertest::~PermissionBubbleBrowsertest() { | |
29 } | |
30 | |
31 void PermissionBubbleBrowsertest::SetUpOnMainThread() { | |
32 ExtensionBrowserTest::SetUpOnMainThread(); | |
33 | |
34 // Add a single permission request. | |
35 MockPermissionBubbleRequest* request = new MockPermissionBubbleRequest( | |
36 "Request 1", l10n_util::GetStringUTF8(IDS_PERMISSION_ALLOW), | |
37 l10n_util::GetStringUTF8(IDS_PERMISSION_DENY)); | |
38 requests_.push_back(request); | |
39 } | |
40 | |
41 PermissionBubbleAppBrowsertest::PermissionBubbleAppBrowsertest() | |
42 : PermissionBubbleBrowsertest(), app_browser_(nullptr) { | |
43 } | |
44 | |
45 PermissionBubbleAppBrowsertest::~PermissionBubbleAppBrowsertest() { | |
46 } | |
47 | |
48 void PermissionBubbleAppBrowsertest::SetUpOnMainThread() { | |
49 PermissionBubbleBrowsertest::SetUpOnMainThread(); | |
50 | |
51 auto extension = | |
52 LoadExtension(test_data_dir_.AppendASCII("app_with_panel_container/")); | |
53 ASSERT_TRUE(extension); | |
54 | |
55 app_browser_ = OpenExtensionAppWindow(extension); | |
56 ASSERT_TRUE(app_browser()); | |
57 ASSERT_TRUE(app_browser()->is_app()); | |
58 } | |
59 | |
60 Browser* PermissionBubbleAppBrowsertest::OpenExtensionAppWindow( | |
61 const extensions::Extension* extension) { | |
62 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | |
63 command_line.AppendSwitchASCII(switches::kAppId, extension->id()); | |
64 | |
65 AppLaunchParams params(browser()->profile(), extension, | |
66 extensions::LAUNCH_CONTAINER_PANEL, NEW_WINDOW, | |
67 extensions::SOURCE_COMMAND_LINE); | |
68 params.command_line = command_line; | |
69 params.current_directory = base::FilePath(); | |
70 | |
71 content::WebContents* app_window = OpenApplication(params); | |
72 assert(app_window); | |
73 | |
74 return chrome::FindBrowserWithWebContents(app_window); | |
75 } | |
76 | |
77 PermissionBubbleKioskBrowsertest::PermissionBubbleKioskBrowsertest() | |
78 : PermissionBubbleBrowsertest() { | |
79 } | |
80 | |
81 PermissionBubbleKioskBrowsertest::~PermissionBubbleKioskBrowsertest() { | |
82 } | |
83 | |
84 void PermissionBubbleKioskBrowsertest::SetUpCommandLine( | |
85 base::CommandLine* command_line) { | |
86 PermissionBubbleBrowsertest::SetUpCommandLine(command_line); | |
87 command_line->AppendSwitch(switches::kKioskMode); | |
88 } | |
OLD | NEW |