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

Side by Side Diff: chrome/browser/plugins/flash_permission_browsertest.cc

Issue 2465953002: Move Field Trial Utils from chrome/common/variations to components/variations/field_trial_util (Closed)
Patch Set: Moved to components/variations/field_trial_util and chrome switches Created 4 years, 1 month 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 #include "base/base_switches.h" 5 #include "base/base_switches.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "chrome/browser/permissions/permissions_browsertest.h" 8 #include "chrome/browser/permissions/permissions_browsertest.h"
9 #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h" 9 #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "components/variations/variations_switches.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/ppapi_test_utils.h" 16 #include "content/public/test/ppapi_test_utils.h"
17 #include "third_party/WebKit/public/web/WebInputEvent.h" 17 #include "third_party/WebKit/public/web/WebInputEvent.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 class FlashPermissionBrowserTest : public PermissionsBrowserTest { 20 class FlashPermissionBrowserTest : public PermissionsBrowserTest {
21 public: 21 public:
22 FlashPermissionBrowserTest() 22 FlashPermissionBrowserTest()
23 : PermissionsBrowserTest("/permissions/flash.html") {} 23 : PermissionsBrowserTest("/permissions/flash.html") {}
24 ~FlashPermissionBrowserTest() override {} 24 ~FlashPermissionBrowserTest() override {}
25 25
26 // PermissionsBrowserTest 26 // PermissionsBrowserTest
27 void SetUpCommandLine(base::CommandLine* command_line) override { 27 void SetUpCommandLine(base::CommandLine* command_line) override {
28 PermissionsBrowserTest::SetUpCommandLine(command_line); 28 PermissionsBrowserTest::SetUpCommandLine(command_line);
29 29
30 ASSERT_TRUE(ppapi::RegisterFlashTestPlugin(command_line)); 30 ASSERT_TRUE(ppapi::RegisterFlashTestPlugin(command_line));
31 31
32 // Set a high engagement threshhold so it doesn't interfere with testing the 32 // Set a high engagement threshhold so it doesn't interfere with testing the
33 // permission. 33 // permission.
34 command_line->AppendSwitchASCII(switches::kEnableFeatures, 34 command_line->AppendSwitchASCII(switches::kEnableFeatures,
35 "PreferHtmlOverPlugins<Study1"); 35 "PreferHtmlOverPlugins<Study1");
36 command_line->AppendSwitchASCII(switches::kForceFieldTrials, 36 command_line->AppendSwitchASCII(switches::kForceFieldTrials,
37 "Study1/Enabled/"); 37 "Study1/Enabled/");
38 command_line->AppendSwitchASCII( 38 command_line->AppendSwitchASCII(
39 switches::kForceFieldTrialParams, 39 variations::switches::kForceFieldTrialParams,
40 "Study1.Enabled:engagement_threshold_for_flash/100"); 40 "Study1.Enabled:engagement_threshold_for_flash/100");
41 } 41 }
42 42
43 void TriggerPrompt() override { 43 void TriggerPrompt() override {
44 if (prompt_factory()->response_type() == 44 if (prompt_factory()->response_type() ==
45 PermissionRequestManager::ACCEPT_ALL) { 45 PermissionRequestManager::ACCEPT_ALL) {
46 // If the prompt will be allowed, we need to wait for the page to refresh. 46 // If the prompt will be allowed, we need to wait for the page to refresh.
47 content::TestNavigationManager observer( 47 content::TestNavigationManager observer(
48 GetWebContents(), GetWebContents()->GetLastCommittedURL()); 48 GetWebContents(), GetWebContents()->GetLastCommittedURL());
49 EXPECT_TRUE(RunScriptReturnBool("triggerPrompt();")); 49 EXPECT_TRUE(RunScriptReturnBool("triggerPrompt();"));
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 browser(), GURL("file://" + test_path.AsUTF8Unsafe() + test_url())); 131 browser(), GURL("file://" + test_path.AsUTF8Unsafe() + test_url()));
132 CommonFailsIfBlocked(); 132 CommonFailsIfBlocked();
133 EXPECT_EQ(1, prompt_factory()->total_request_count()); 133 EXPECT_EQ(1, prompt_factory()->total_request_count());
134 134
135 // Navigate to a second URL to verify it's blocked on all file: URLs. 135 // Navigate to a second URL to verify it's blocked on all file: URLs.
136 ui_test_utils::NavigateToURL( 136 ui_test_utils::NavigateToURL(
137 browser(), 137 browser(),
138 GURL("file://" + test_path.AsUTF8Unsafe() + "/permissions/flash2.html")); 138 GURL("file://" + test_path.AsUTF8Unsafe() + "/permissions/flash2.html"));
139 EXPECT_FALSE(FeatureUsageSucceeds()); 139 EXPECT_FALSE(FeatureUsageSucceeds());
140 } 140 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/tracing/background_tracing_field_trial.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698