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

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

Issue 2350733005: [Extensions] Fix a bug in the startup pages override bubble (Closed)
Patch Set: Trim includes Created 4 years, 2 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/browser_process.h"
10 #include "chrome/browser/extensions/extension_action_test_util.h" 11 #include "chrome/browser/extensions/extension_action_test_util.h"
11 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/test_extension_dir.h" 13 #include "chrome/browser/extensions/test_extension_dir.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/browser_commands.h" 15 #include "chrome/browser/ui/browser_commands.h"
15 #include "chrome/browser/ui/browser_window.h" 16 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/extensions/extension_message_bubble_factory.h" 17 #include "chrome/browser/ui/extensions/extension_message_bubble_factory.h"
17 #include "chrome/browser/ui/location_bar/location_bar.h" 18 #include "chrome/browser/ui/location_bar/location_bar.h"
19 #include "chrome/browser/ui/startup/startup_browser_creator.h"
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" 20 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 21 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
20 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
21 #include "chrome/common/url_constants.h" 23 #include "chrome/common/url_constants.h"
22 #include "components/omnibox/browser/omnibox_edit_model.h" 24 #include "components/omnibox/browser/omnibox_edit_model.h"
23 #include "content/public/test/browser_test_utils.h" 25 #include "content/public/test/browser_test_utils.h"
24 #include "extensions/browser/extension_registry.h" 26 #include "extensions/browser/extension_registry.h"
25 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
26 #include "extensions/common/feature_switch.h" 28 #include "extensions/common/feature_switch.h"
27 #include "extensions/test/extension_test_message_listener.h" 29 #include "extensions/test/extension_test_message_listener.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 omnibox->OnBeforePossibleChange(); 251 omnibox->OnBeforePossibleChange();
250 omnibox->SetUserText(base::ASCIIToUTF16("search for this")); 252 omnibox->SetUserText(base::ASCIIToUTF16("search for this"));
251 omnibox->OnAfterPossibleChange(true); 253 omnibox->OnAfterPossibleChange(true);
252 omnibox->model()->AcceptInput(WindowOpenDisposition::CURRENT_TAB, false); 254 omnibox->model()->AcceptInput(WindowOpenDisposition::CURRENT_TAB, false);
253 base::RunLoop().RunUntilIdle(); 255 base::RunLoop().RunUntilIdle();
254 256
255 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false); 257 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, false);
256 CloseBubble(browser()); 258 CloseBubble(browser());
257 } 259 }
258 260
261 void ExtensionMessageBubbleBrowserTest::PreTestControlledStartupBubbleShown() {
262 ASSERT_TRUE(InstallExtensionWithPermissionsGranted(
263 test_data_dir_.AppendASCII("startup_pages"), 1));
264 }
265
266 void ExtensionMessageBubbleBrowserTest::TestControlledStartupBubbleShown() {
267 base::RunLoop().RunUntilIdle();
268 CheckBubble(browser(), ANCHOR_BROWSER_ACTION, true);
269 CloseBubble(browser());
270 }
271
272 void ExtensionMessageBubbleBrowserTest::
273 PreTestControlledStartupNotShownOnRestart() {
274 ASSERT_TRUE(InstallExtensionWithPermissionsGranted(
275 test_data_dir_.AppendASCII("startup_pages"), 1));
276 PrefService* pref_service = g_browser_process->local_state();
277 pref_service->SetBoolean(prefs::kWasRestarted, true);
278 }
279
280 void ExtensionMessageBubbleBrowserTest::
281 TestControlledStartupNotShownOnRestart() {
282 EXPECT_TRUE(StartupBrowserCreator::WasRestarted());
283 CheckBubbleIsNotPresent(browser(), false, false);
284 }
285
259 void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() { 286 void ExtensionMessageBubbleBrowserTest::TestBubbleWithMultipleWindows() {
260 CheckBubbleIsNotPresent(browser(), false, false); 287 CheckBubbleIsNotPresent(browser(), false, false);
261 LoadExtension(test_data_dir_.AppendASCII("good_unpacked")); 288 LoadExtension(test_data_dir_.AppendASCII("good_unpacked"));
262 Browser* second_browser = new Browser(Browser::CreateParams(profile())); 289 Browser* second_browser = new Browser(Browser::CreateParams(profile()));
263 Browser* third_browser = new Browser(Browser::CreateParams(profile())); 290 Browser* third_browser = new Browser(Browser::CreateParams(profile()));
264 Browser* fourth_browser = new Browser(Browser::CreateParams(profile())); 291 Browser* fourth_browser = new Browser(Browser::CreateParams(profile()));
265 base::RunLoop().RunUntilIdle(); 292 base::RunLoop().RunUntilIdle();
266 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); 293 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
267 // Even though the bubble isn't present on these browser windows, highlighting 294 // Even though the bubble isn't present on these browser windows, highlighting
268 // is per-profile. 295 // is per-profile.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 Browser* second_browser = new Browser(Browser::CreateParams(profile())); 346 Browser* second_browser = new Browser(Browser::CreateParams(profile()));
320 base::RunLoop().RunUntilIdle(); 347 base::RunLoop().RunUntilIdle();
321 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true); 348 CheckBubble(second_browser, ANCHOR_BROWSER_ACTION, true);
322 ClickDismissButton(second_browser); 349 ClickDismissButton(second_browser);
323 base::RunLoop().RunUntilIdle(); 350 base::RunLoop().RunUntilIdle();
324 CheckBubbleIsNotPresent(browser(), false, false); 351 CheckBubbleIsNotPresent(browser(), false, false);
325 // Clicking dismiss should have no affect, so the extension should still be 352 // Clicking dismiss should have no affect, so the extension should still be
326 // active. 353 // active.
327 EXPECT_TRUE(registry->enabled_extensions().GetByID(id)); 354 EXPECT_TRUE(registry->enabled_extensions().GetByID(id));
328 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698