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

Side by Side Diff: chrome/browser/ui/panels/panel_browsertest.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/devtools/devtools_window.h" 9 #include "chrome/browser/devtools/devtools_window.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 10 #include "chrome/browser/extensions/extension_apitest.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state()); 269 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
270 scoped_ptr<NativePanelTesting> panel1_testing( 270 scoped_ptr<NativePanelTesting> panel1_testing(
271 CreateNativePanelTesting(panel1)); 271 CreateNativePanelTesting(panel1));
272 scoped_ptr<NativePanelTesting> panel2_testing( 272 scoped_ptr<NativePanelTesting> panel2_testing(
273 CreateNativePanelTesting(panel2)); 273 CreateNativePanelTesting(panel2));
274 scoped_ptr<NativePanelTesting> panel3_testing( 274 scoped_ptr<NativePanelTesting> panel3_testing(
275 CreateNativePanelTesting(panel3)); 275 CreateNativePanelTesting(panel3));
276 276
277 // Ensure that the layout message can get a chance to be processed so that 277 // Ensure that the layout message can get a chance to be processed so that
278 // the button visibility can be updated. 278 // the button visibility can be updated.
279 MessageLoop::current()->RunUntilIdle(); 279 base::MessageLoop::current()->RunUntilIdle();
280 280
281 EXPECT_EQ(3, panel_manager->num_panels()); 281 EXPECT_EQ(3, panel_manager->num_panels());
282 EXPECT_TRUE(docked_collection->HasPanel(panel1)); 282 EXPECT_TRUE(docked_collection->HasPanel(panel1));
283 EXPECT_TRUE(docked_collection->HasPanel(panel2)); 283 EXPECT_TRUE(docked_collection->HasPanel(panel2));
284 EXPECT_TRUE(docked_collection->HasPanel(panel3)); 284 EXPECT_TRUE(docked_collection->HasPanel(panel3));
285 285
286 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); 286 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state());
287 EXPECT_EQ(Panel::TITLE_ONLY, panel2->expansion_state()); 287 EXPECT_EQ(Panel::TITLE_ONLY, panel2->expansion_state());
288 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state()); 288 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
289 289
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 int bottom_bar_thickness_delta = 10; 907 int bottom_bar_thickness_delta = 10;
908 bottom_bar_thickness += bottom_bar_thickness_delta; 908 bottom_bar_thickness += bottom_bar_thickness_delta;
909 int right_bar_thickness_delta = 15; 909 int right_bar_thickness_delta = 15;
910 right_bar_thickness += right_bar_thickness_delta; 910 right_bar_thickness += right_bar_thickness_delta;
911 mock_display_settings_provider()->SetDesktopBarThickness( 911 mock_display_settings_provider()->SetDesktopBarThickness(
912 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_BOTTOM, 912 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_BOTTOM,
913 bottom_bar_thickness); 913 bottom_bar_thickness);
914 mock_display_settings_provider()->SetDesktopBarThickness( 914 mock_display_settings_provider()->SetDesktopBarThickness(
915 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_RIGHT, 915 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_RIGHT,
916 right_bar_thickness); 916 right_bar_thickness);
917 MessageLoopForUI::current()->RunUntilIdle(); 917 base::MessageLoopForUI::current()->RunUntilIdle();
918 EXPECT_EQ(initial_starting_right_position, 918 EXPECT_EQ(initial_starting_right_position,
919 docked_collection->StartingRightPosition()); 919 docked_collection->StartingRightPosition());
920 EXPECT_EQ(docked_collection->work_area().bottom() - bottom_bar_thickness, 920 EXPECT_EQ(docked_collection->work_area().bottom() - bottom_bar_thickness,
921 panel->GetBounds().bottom()); 921 panel->GetBounds().bottom());
922 EXPECT_EQ(docked_collection->StartingRightPosition(), 922 EXPECT_EQ(docked_collection->StartingRightPosition(),
923 panel->GetBounds().right()); 923 panel->GetBounds().right());
924 924
925 initial_starting_right_position = docked_collection->StartingRightPosition(); 925 initial_starting_right_position = docked_collection->StartingRightPosition();
926 bottom_bar_thickness_delta = 20; 926 bottom_bar_thickness_delta = 20;
927 bottom_bar_thickness -= bottom_bar_thickness_delta; 927 bottom_bar_thickness -= bottom_bar_thickness_delta;
928 right_bar_thickness_delta = 10; 928 right_bar_thickness_delta = 10;
929 right_bar_thickness -= right_bar_thickness_delta; 929 right_bar_thickness -= right_bar_thickness_delta;
930 mock_display_settings_provider()->SetDesktopBarThickness( 930 mock_display_settings_provider()->SetDesktopBarThickness(
931 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_BOTTOM, 931 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_BOTTOM,
932 bottom_bar_thickness); 932 bottom_bar_thickness);
933 mock_display_settings_provider()->SetDesktopBarThickness( 933 mock_display_settings_provider()->SetDesktopBarThickness(
934 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_RIGHT, 934 DisplaySettingsProvider::DESKTOP_BAR_ALIGNED_RIGHT,
935 right_bar_thickness); 935 right_bar_thickness);
936 MessageLoopForUI::current()->RunUntilIdle(); 936 base::MessageLoopForUI::current()->RunUntilIdle();
937 EXPECT_EQ(docked_collection->StartingRightPosition(), 937 EXPECT_EQ(docked_collection->StartingRightPosition(),
938 initial_starting_right_position); 938 initial_starting_right_position);
939 EXPECT_EQ(docked_collection->work_area().bottom() - bottom_bar_thickness, 939 EXPECT_EQ(docked_collection->work_area().bottom() - bottom_bar_thickness,
940 panel->GetBounds().bottom()); 940 panel->GetBounds().bottom());
941 EXPECT_EQ(docked_collection->StartingRightPosition(), 941 EXPECT_EQ(docked_collection->StartingRightPosition(),
942 panel->GetBounds().right()); 942 panel->GetBounds().right());
943 943
944 panel->Close(); 944 panel->Close();
945 } 945 }
946 946
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 content::Source<Browser>(browser())); 1414 content::Source<Browser>(browser()));
1415 chrome::CloseWindow(browser()); 1415 chrome::CloseWindow(browser());
1416 signal.Wait(); 1416 signal.Wait();
1417 1417
1418 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state()); 1418 EXPECT_EQ(Panel::EXPANDED, panel1->expansion_state());
1419 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); 1419 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
1420 panel1->Activate(); 1420 panel1->Activate();
1421 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE); 1421 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE);
1422 1422
1423 panel1->SetExpansionState(Panel::MINIMIZED); 1423 panel1->SetExpansionState(Panel::MINIMIZED);
1424 MessageLoop::current()->RunUntilIdle(); 1424 base::MessageLoop::current()->RunUntilIdle();
1425 WaitForPanelActiveState(panel1, SHOW_AS_INACTIVE); 1425 WaitForPanelActiveState(panel1, SHOW_AS_INACTIVE);
1426 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 1426 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1427 1427
1428 panel2->SetExpansionState(Panel::MINIMIZED); 1428 panel2->SetExpansionState(Panel::MINIMIZED);
1429 MessageLoop::current()->RunUntilIdle(); 1429 base::MessageLoop::current()->RunUntilIdle();
1430 WaitForPanelActiveState(panel2, SHOW_AS_INACTIVE); 1430 WaitForPanelActiveState(panel2, SHOW_AS_INACTIVE);
1431 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state()); 1431 EXPECT_EQ(Panel::MINIMIZED, panel2->expansion_state());
1432 1432
1433 // Verify that panel1 is still minimized and not active. 1433 // Verify that panel1 is still minimized and not active.
1434 WaitForPanelActiveState(panel1, SHOW_AS_INACTIVE); 1434 WaitForPanelActiveState(panel1, SHOW_AS_INACTIVE);
1435 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 1435 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
1436 1436
1437 // Another check for the same. 1437 // Another check for the same.
1438 EXPECT_FALSE(panel1->IsActive()); 1438 EXPECT_FALSE(panel1->IsActive());
1439 EXPECT_FALSE(panel2->IsActive()); 1439 EXPECT_FALSE(panel2->IsActive());
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1816 #else 1816 #else
1817 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize 1817 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize
1818 #endif 1818 #endif
1819 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, 1819 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest,
1820 MAYBE_FocusChangeEventOnMinimize) { 1820 MAYBE_FocusChangeEventOnMinimize) {
1821 // This is needed so the subsequently created panels can be activated. 1821 // This is needed so the subsequently created panels can be activated.
1822 // On a Mac, it transforms background-only test process into foreground one. 1822 // On a Mac, it transforms background-only test process into foreground one.
1823 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 1823 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
1824 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; 1824 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_;
1825 } 1825 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/docked_panel_collection.cc ('k') | chrome/browser/ui/panels/panel_drag_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698