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

Side by Side Diff: chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h

Issue 2835863003: MediaStreamDevicesControllerBrowserTest (Closed)
Patch Set: MediaStreamDevicesControllerBrowserTest Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_ 5 #ifndef CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_
6 #define CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_ 6 #define CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "chrome/browser/permissions/permission_request.h"
11 #include "chrome/browser/permissions/permission_request_manager.h" 12 #include "chrome/browser/permissions/permission_request_manager.h"
12 13
13 class MockPermissionPrompt; 14 class MockPermissionPrompt;
14 class PermissionPrompt; 15 class PermissionPrompt;
15 16
16 namespace content { 17 namespace content {
17 class WebContents; 18 class WebContents;
18 } 19 }
19 20
20 // Provides a skeleton class for both unit and browser testing when trying to 21 // Provides a skeleton class for both unit and browser testing when trying to
(...skipping 23 matching lines...) Expand all
44 return response_type_; 45 return response_type_;
45 } 46 }
46 47
47 // If the current view is visible. 48 // If the current view is visible.
48 bool is_visible(); 49 bool is_visible();
49 // Number of times |Show| was called on any bubble. 50 // Number of times |Show| was called on any bubble.
50 int show_count() { return show_count_; } 51 int show_count() { return show_count_; }
51 // Number of requests seen by the last |Show|. 52 // Number of requests seen by the last |Show|.
52 int request_count() { return requests_count_; } 53 int request_count() { return requests_count_; }
53 // Number of requests seen. 54 // Number of requests seen.
54 int total_request_count() { return total_requests_count_; } 55 int TotalRequestCount();
56 // Whether the specified permission was shown in a prompt.
57 bool RequestTypeSeen(PermissionRequestType type);
55 58
56 void WaitForPermissionBubble(); 59 void WaitForPermissionBubble();
57 60
58 private: 61 private:
59 friend class MockPermissionPrompt; 62 friend class MockPermissionPrompt;
60 63
61 // This shouldn't be called. Is here to fail tests that try to create a bubble 64 // This shouldn't be called. Is here to fail tests that try to create a bubble
62 // after the factory has been destroyed. 65 // after the factory has been destroyed.
63 static std::unique_ptr<PermissionPrompt> DoNotCreate( 66 static std::unique_ptr<PermissionPrompt> DoNotCreate(
64 content::WebContents* web_contents); 67 content::WebContents* web_contents);
65 68
66 void UpdateResponseType(); 69 void UpdateResponseType();
67 void ShowView(MockPermissionPrompt* view); 70 void ShowView(MockPermissionPrompt* view);
68 void HideView(MockPermissionPrompt* view); 71 void HideView(MockPermissionPrompt* view);
69 72
70 bool can_update_ui_; 73 bool can_update_ui_;
71 int show_count_; 74 int show_count_;
72 int requests_count_; 75 int requests_count_;
73 int total_requests_count_; 76 std::vector<PermissionRequestType> request_types_seen_;
77
74 std::vector<MockPermissionPrompt*> prompts_; 78 std::vector<MockPermissionPrompt*> prompts_;
75 PermissionRequestManager::AutoResponseType response_type_; 79 PermissionRequestManager::AutoResponseType response_type_;
76 80
77 base::Closure show_bubble_quit_closure_; 81 base::Closure show_bubble_quit_closure_;
78 82
79 // The bubble manager that will be associated with this factory. 83 // The bubble manager that will be associated with this factory.
80 PermissionRequestManager* manager_; 84 PermissionRequestManager* manager_;
81 85
82 DISALLOW_COPY_AND_ASSIGN(MockPermissionPromptFactory); 86 DISALLOW_COPY_AND_ASSIGN(MockPermissionPromptFactory);
83 }; 87 };
84 88
85 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_ 89 #endif // CHROME_BROWSER_UI_PERMISSION_BUBBLE_MOCK_PERMISSION_PROMPT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698