OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/macros.h" | 5 #include "base/macros.h" |
6 #include "chrome/browser/extensions/extension_browsertest.h" | 6 #include "chrome/browser/extensions/extension_browsertest.h" |
7 #include "chrome/browser/extensions/extension_toolbar_model.h" | 7 #include "chrome/browser/extensions/extension_toolbar_model.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 | 577 |
578 // When we stop highlighting, we should see the new extension show up. | 578 // When we stop highlighting, we should see the new extension show up. |
579 model_->StopHighlighting(); | 579 model_->StopHighlighting(); |
580 EXPECT_FALSE(model_->is_highlighting()); | 580 EXPECT_FALSE(model_->is_highlighting()); |
581 EXPECT_EQ(3u, model_->toolbar_items().size()); | 581 EXPECT_EQ(3u, model_->toolbar_items().size()); |
582 EXPECT_EQ(id_a, ExtensionAt(0)->id()); | 582 EXPECT_EQ(id_a, ExtensionAt(0)->id()); |
583 EXPECT_EQ(id_b, ExtensionAt(1)->id()); | 583 EXPECT_EQ(id_b, ExtensionAt(1)->id()); |
584 EXPECT_EQ(id_c, ExtensionAt(2)->id()); | 584 EXPECT_EQ(id_c, ExtensionAt(2)->id()); |
585 } | 585 } |
586 | 586 |
587 // Test is flaky (see crbug.com/379170), but currently enabled to gather traces. | 587 // Test is flaky on Linus and ChromeOS, see crbug.com/379170. |
588 // If it fails, ping Finnur. | 588 #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
589 IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, SizeAfterPrefChange) { | 589 #define MAYBE_SizeAfterPrefChange DISABLED_SizeAfterPrefChange |
| 590 #else |
| 591 #define MAYBE_SizeAfterPrefChange SizeAfterPrefChange |
| 592 #endif |
| 593 IN_PROC_BROWSER_TEST_F(ExtensionToolbarModelTest, MAYBE_SizeAfterPrefChange) { |
590 // Load two extensions with browser action. | 594 // Load two extensions with browser action. |
591 base::FilePath extension_a_path(test_data_dir_.AppendASCII("api_test") | 595 base::FilePath extension_a_path(test_data_dir_.AppendASCII("api_test") |
592 .AppendASCII("browser_action") | 596 .AppendASCII("browser_action") |
593 .AppendASCII("basics")); | 597 .AppendASCII("basics")); |
594 LOG(ERROR) << "Loading [basics]"; | 598 LOG(ERROR) << "Loading [basics]"; |
595 ASSERT_TRUE(LoadExtension(extension_a_path)); | 599 ASSERT_TRUE(LoadExtension(extension_a_path)); |
596 base::FilePath extension_b_path(test_data_dir_.AppendASCII("api_test") | 600 base::FilePath extension_b_path(test_data_dir_.AppendASCII("api_test") |
597 .AppendASCII("browser_action") | 601 .AppendASCII("browser_action") |
598 .AppendASCII("popup")); | 602 .AppendASCII("popup")); |
599 LOG(ERROR) << "Loading [popup]"; | 603 LOG(ERROR) << "Loading [popup]"; |
600 ASSERT_TRUE(LoadExtension(extension_b_path)); | 604 ASSERT_TRUE(LoadExtension(extension_b_path)); |
601 std::string id_a = ExtensionAt(0)->id(); | 605 std::string id_a = ExtensionAt(0)->id(); |
602 std::string id_b = ExtensionAt(1)->id(); | 606 std::string id_b = ExtensionAt(1)->id(); |
603 | 607 |
604 LOG(ERROR) << "GetVisibleIconCount"; | 608 LOG(ERROR) << "GetVisibleIconCount"; |
605 | 609 |
606 // Should be at max size (-1). | 610 // Should be at max size (-1). |
607 EXPECT_EQ(-1, model_->GetVisibleIconCount()); | 611 EXPECT_EQ(-1, model_->GetVisibleIconCount()); |
608 | 612 |
609 LOG(ERROR) << "OnExtensionToolbarPrefChange"; | 613 LOG(ERROR) << "OnExtensionToolbarPrefChange"; |
610 model_->OnExtensionToolbarPrefChange(); | 614 model_->OnExtensionToolbarPrefChange(); |
611 | 615 |
612 LOG(ERROR) << "GetVisibleIconCount"; | 616 LOG(ERROR) << "GetVisibleIconCount"; |
613 | 617 |
614 // Should still be at max size. | 618 // Should still be at max size. |
615 EXPECT_EQ(-1, model_->GetVisibleIconCount()); | 619 EXPECT_EQ(-1, model_->GetVisibleIconCount()); |
616 } | 620 } |
617 | 621 |
618 } // namespace extensions | 622 } // namespace extensions |
OLD | NEW |