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

Side by Side Diff: chrome/browser/ui/extensions/extension_message_bubble_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ui/extensions/extension_message_bubble_browsertest.h" 5 #include "chrome/browser/ui/extensions/extension_message_bubble_browsertest.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/extensions/extension_action_test_util.h" 10 #include "chrome/browser/extensions/extension_action_test_util.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } 215 }
216 216
217 void ExtensionMessageBubbleBrowserTest::TestControlledHomeBubbleShown() { 217 void ExtensionMessageBubbleBrowserTest::TestControlledHomeBubbleShown() {
218 browser()->profile()->GetPrefs()->SetBoolean(prefs::kShowHomeButton, true); 218 browser()->profile()->GetPrefs()->SetBoolean(prefs::kShowHomeButton, true);
219 219
220 const char kHomePage[] = "'homepage': 'https://www.google.com'\n"; 220 const char kHomePage[] = "'homepage': 'https://www.google.com'\n";
221 AddSettingsOverrideExtension(kHomePage); 221 AddSettingsOverrideExtension(kHomePage);
222 222
223 CheckBubbleIsNotPresent(browser(), false, false); 223 CheckBubbleIsNotPresent(browser(), false, false);
224 224
225 chrome::ExecuteCommandWithDisposition(browser(), 225 chrome::ExecuteCommandWithDisposition(
226 IDC_HOME, NEW_FOREGROUND_TAB); 226 browser(), IDC_HOME, WindowOpenDisposition::NEW_FOREGROUND_TAB);
227 base::RunLoop().RunUntilIdle(); 227 base::RunLoop().RunUntilIdle();
228 228
229 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false); 229 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false);
230 CloseBubble(browser()); 230 CloseBubble(browser());
231 } 231 }
232 232
233 void ExtensionMessageBubbleBrowserTest::TestControlledSearchBubbleShown() { 233 void ExtensionMessageBubbleBrowserTest::TestControlledSearchBubbleShown() {
234 const char kSearchProvider[] = 234 const char kSearchProvider[] =
235 "'search_provider': {\n" 235 "'search_provider': {\n"
236 " 'search_url': 'https://www.google.com/search?q={searchTerms}',\n" 236 " 'search_url': 'https://www.google.com/search?q={searchTerms}',\n"
237 " 'is_default': true,\n" 237 " 'is_default': true,\n"
238 " 'favicon_url': 'https://www.google.com/favicon.icon',\n" 238 " 'favicon_url': 'https://www.google.com/favicon.icon',\n"
239 " 'keyword': 'TheGoogs',\n" 239 " 'keyword': 'TheGoogs',\n"
240 " 'name': 'Google',\n" 240 " 'name': 'Google',\n"
241 " 'encoding': 'UTF-8'\n" 241 " 'encoding': 'UTF-8'\n"
242 "}\n"; 242 "}\n";
243 AddSettingsOverrideExtension(kSearchProvider); 243 AddSettingsOverrideExtension(kSearchProvider);
244 244
245 CheckBubbleIsNotPresent(browser(), false, false); 245 CheckBubbleIsNotPresent(browser(), false, false);
246 246
247 OmniboxView* omnibox = 247 OmniboxView* omnibox =
248 browser()->window()->GetLocationBar()->GetOmniboxView(); 248 browser()->window()->GetLocationBar()->GetOmniboxView();
249 omnibox->OnBeforePossibleChange(); 249 omnibox->OnBeforePossibleChange();
250 omnibox->SetUserText(base::ASCIIToUTF16("search for this")); 250 omnibox->SetUserText(base::ASCIIToUTF16("search for this"));
251 omnibox->OnAfterPossibleChange(true); 251 omnibox->OnAfterPossibleChange(true);
252 omnibox->model()->AcceptInput(CURRENT_TAB, false); 252 omnibox->model()->AcceptInput(WindowOpenDisposition::CURRENT_TAB, false);
253 base::RunLoop().RunUntilIdle(); 253 base::RunLoop().RunUntilIdle();
254 254
255 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false); 255 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false);
256 CloseBubble(browser()); 256 CloseBubble(browser());
257 } 257 }
258 258
259 void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() { 259 void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() {
260 CheckBubbleIsNotPresent(browser(), false, false); 260 CheckBubbleIsNotPresent(browser(), false, false);
261 LoadExtension(test_data_dir_.AppendASCII("good_unpacked")); 261 LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
262 Browser* second_browser = new Browser(Browser::CreateParams(profile())); 262 Browser* second_browser = new Browser(Browser::CreateParams(profile()));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 Browser* second_browser = new Browser(Browser::CreateParams(profile())); 319 Browser* second_browser = new Browser(Browser::CreateParams(profile()));
320 base::RunLoop().RunUntilIdle(); 320 base::RunLoop().RunUntilIdle();
321 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); 321 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
322 ClickDismissButton(second_browser); 322 ClickDismissButton(second_browser);
323 base::RunLoop().RunUntilIdle(); 323 base::RunLoop().RunUntilIdle();
324 CheckBubbleIsNotPresent(browser(), false, false); 324 CheckBubbleIsNotPresent(browser(), false, false);
325 // Clicking dismiss should have no affect, so the extension should still be 325 // Clicking dismiss should have no affect, so the extension should still be
326 // active. 326 // active.
327 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); 327 EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
328 } 328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698