| OLD | NEW |
| 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_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // permission that is being added. Custom tests can also be added for the | 23 // permission that is being added. Custom tests can also be added for the |
| 24 // permission. For an example of how to use this base class, see | 24 // permission. For an example of how to use this base class, see |
| 25 // FlashPermissionBrowserTest. | 25 // FlashPermissionBrowserTest. |
| 26 class PermissionsBrowserTest : public InProcessBrowserTest { | 26 class PermissionsBrowserTest : public InProcessBrowserTest { |
| 27 public: | 27 public: |
| 28 explicit PermissionsBrowserTest(const std::string& test_url); | 28 explicit PermissionsBrowserTest(const std::string& test_url); |
| 29 ~PermissionsBrowserTest() override; | 29 ~PermissionsBrowserTest() override; |
| 30 | 30 |
| 31 // InProcessBrowserTest | 31 // InProcessBrowserTest |
| 32 void SetUpOnMainThread() override; | 32 void SetUpOnMainThread() override; |
| 33 void TearDownOnMainThread() override; | |
| 34 | 33 |
| 35 virtual void TriggerPrompt() = 0; | 34 virtual void TriggerPrompt() = 0; |
| 36 virtual bool FeatureUsageSucceeds() = 0; | 35 virtual bool FeatureUsageSucceeds() = 0; |
| 37 | 36 |
| 38 std::string test_url() const { return test_url_; } | 37 std::string test_url() const { return test_url_; } |
| 39 | 38 |
| 40 MockPermissionPromptFactory* prompt_factory() { | 39 MockPermissionPromptFactory* prompt_factory() { |
| 41 return prompt_factory_.get(); | 40 return prompt_factory_.get(); |
| 42 } | 41 } |
| 43 | 42 |
| 44 protected: | 43 protected: |
| 45 bool RunScriptReturnBool(const std::string& script); | 44 bool RunScriptReturnBool(const std::string& script); |
| 46 | 45 |
| 47 content::WebContents* GetWebContents(); | 46 content::WebContents* GetWebContents(); |
| 48 | 47 |
| 49 // Common tests that should be called by subclasses. | 48 // Common tests that should be called by subclasses. |
| 50 void CommonFailsBeforeRequesting(); | 49 void CommonFailsBeforeRequesting(); |
| 51 void CommonFailsIfDismissed(); | 50 void CommonFailsIfDismissed(); |
| 52 void CommonFailsIfBlocked(); | 51 void CommonFailsIfBlocked(); |
| 53 void CommonSucceedsIfAllowed(); | 52 void CommonSucceedsIfAllowed(); |
| 54 | 53 |
| 55 private: | 54 private: |
| 56 std::string test_url_; | 55 std::string test_url_; |
| 57 std::unique_ptr<MockPermissionPromptFactory> prompt_factory_; | 56 std::unique_ptr<MockPermissionPromptFactory> prompt_factory_; |
| 58 }; | 57 }; |
| 59 | 58 |
| 60 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ | 59 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSIONS_BROWSERTEST_H_ |
| OLD | NEW |