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

Side by Side Diff: chrome/browser/external_protocol/external_protocol_handler_unittest.cc

Issue 131783012: Fix the handling of user gestures for external protocol handler dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: joi and pkasting comments Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/external_protocol/external_protocol_handler.h" 5 #include "chrome/browser/external_protocol/external_protocol_handler.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "content/public/test/test_browser_thread.h" 8 #include "content/public/test/test_browser_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 class ExternalProtocolHandlerTest : public testing::Test { 100 class ExternalProtocolHandlerTest : public testing::Test {
101 protected: 101 protected:
102 ExternalProtocolHandlerTest() 102 ExternalProtocolHandlerTest()
103 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()), 103 : ui_thread_(BrowserThread::UI, base::MessageLoop::current()),
104 file_thread_(BrowserThread::FILE) {} 104 file_thread_(BrowserThread::FILE) {}
105 105
106 virtual void SetUp() { 106 virtual void SetUp() {
107 file_thread_.Start(); 107 file_thread_.Start();
108 } 108 }
109 109
110 virtual void TearDown() {
111 // Ensure that g_accept_requests gets set back to true after test execution.
112 ExternalProtocolHandler::PermitLaunchUrl();
113 }
114
115 void DoTest(ExternalProtocolHandler::BlockState block_state, 110 void DoTest(ExternalProtocolHandler::BlockState block_state,
116 ShellIntegration::DefaultWebClientState os_state, 111 ShellIntegration::DefaultWebClientState os_state,
117 bool should_prompt, bool should_launch, bool should_block) { 112 bool should_prompt, bool should_launch, bool should_block) {
118 GURL url("mailto:test@test.com"); 113 GURL url("mailto:test@test.com");
119 ASSERT_FALSE(delegate_.has_prompted()); 114 ASSERT_FALSE(delegate_.has_prompted());
120 ASSERT_FALSE(delegate_.has_launched()); 115 ASSERT_FALSE(delegate_.has_launched());
121 ASSERT_FALSE(delegate_.has_blocked()); 116 ASSERT_FALSE(delegate_.has_blocked());
122 117
123 delegate_.set_block_state(block_state); 118 delegate_.set_block_state(block_state);
124 delegate_.set_os_state(os_state); 119 delegate_.set_os_state(os_state);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 DoTest(ExternalProtocolHandler::UNKNOWN, 179 DoTest(ExternalProtocolHandler::UNKNOWN,
185 ShellIntegration::NOT_DEFAULT, 180 ShellIntegration::NOT_DEFAULT,
186 true, false, false); 181 true, false, false);
187 } 182 }
188 183
189 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) { 184 TEST_F(ExternalProtocolHandlerTest, TestLaunchSchemeUnknownChromeUnknown) {
190 DoTest(ExternalProtocolHandler::UNKNOWN, 185 DoTest(ExternalProtocolHandler::UNKNOWN,
191 ShellIntegration::UNKNOWN_DEFAULT, 186 ShellIntegration::UNKNOWN_DEFAULT,
192 true, false, false); 187 true, false, false);
193 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698