| OLD | NEW |
| 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/ui/panels/base_panel_browser_test.h" | 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" | 23 #include "chrome/browser/ui/panels/test_panel_active_state_observer.h" |
| 24 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 24 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/test/base/interactive_test_utils.h" | 27 #include "chrome/test/base/interactive_test_utils.h" |
| 28 #include "chrome/test/base/ui_test_utils.h" | 28 #include "chrome/test/base/ui_test_utils.h" |
| 29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/common/url_constants.h" | 30 #include "content/public/common/url_constants.h" |
| 31 #include "content/public/test/web_contents_tester.h" | 31 #include "content/public/test/web_contents_tester.h" |
| 32 #include "extensions/browser/extension_prefs.h" | 32 #include "extensions/browser/extension_prefs.h" |
| 33 #include "extensions/browser/install_flag.h" |
| 33 #include "extensions/common/manifest_constants.h" | 34 #include "extensions/common/manifest_constants.h" |
| 34 #include "sync/api/string_ordinal.h" | 35 #include "sync/api/string_ordinal.h" |
| 35 | 36 |
| 36 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) |
| 37 #include "chrome/browser/ui/browser_window.h" | 38 #include "chrome/browser/ui/browser_window.h" |
| 38 #include "ui/base/x/x11_util.h" | 39 #include "ui/base/x/x11_util.h" |
| 39 #endif | 40 #endif |
| 40 | 41 |
| 41 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
| 42 #include "base/mac/scoped_nsautorelease_pool.h" | 43 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 558 |
| 558 scoped_ptr<base::DictionaryValue> input_value(extra_value.DeepCopy()); | 559 scoped_ptr<base::DictionaryValue> input_value(extra_value.DeepCopy()); |
| 559 input_value->SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); | 560 input_value->SetString(extensions::manifest_keys::kVersion, "1.0.0.0"); |
| 560 input_value->SetString(extensions::manifest_keys::kName, "Sample Extension"); | 561 input_value->SetString(extensions::manifest_keys::kName, "Sample Extension"); |
| 561 | 562 |
| 562 std::string error; | 563 std::string error; |
| 563 scoped_refptr<Extension> extension = Extension::Create( | 564 scoped_refptr<Extension> extension = Extension::Create( |
| 564 full_path, location, *input_value, Extension::NO_FLAGS, &error); | 565 full_path, location, *input_value, Extension::NO_FLAGS, &error); |
| 565 EXPECT_TRUE(extension.get()); | 566 EXPECT_TRUE(extension.get()); |
| 566 EXPECT_STREQ("", error.c_str()); | 567 EXPECT_STREQ("", error.c_str()); |
| 567 browser()->profile()->GetExtensionService()-> | 568 browser()->profile()->GetExtensionService()->OnExtensionInstalled( |
| 568 OnExtensionInstalled(extension.get(), | 569 extension.get(), syncer::StringOrdinal(), kInstallFlagInstallImmediately); |
| 569 syncer::StringOrdinal(), | |
| 570 false /* no requirement errors */, | |
| 571 extensions::NOT_BLACKLISTED, | |
| 572 false /* not ephemeral */, | |
| 573 false /* don't wait for idle */); | |
| 574 return extension; | 570 return extension; |
| 575 } | 571 } |
| 576 | 572 |
| 577 void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { | 573 void BasePanelBrowserTest::CloseWindowAndWait(Panel* panel) { |
| 578 // Closing a panel may involve several async tasks. Need to use | 574 // Closing a panel may involve several async tasks. Need to use |
| 579 // message pump and wait for the notification. | 575 // message pump and wait for the notification. |
| 580 PanelManager* manager = PanelManager::GetInstance(); | 576 PanelManager* manager = PanelManager::GetInstance(); |
| 581 int panel_count = manager->num_panels(); | 577 int panel_count = manager->num_panels(); |
| 582 content::WindowedNotificationObserver signal( | 578 content::WindowedNotificationObserver signal( |
| 583 chrome::NOTIFICATION_PANEL_CLOSED, | 579 chrome::NOTIFICATION_PANEL_CLOSED, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 614 } | 610 } |
| 615 | 611 |
| 616 std::string BasePanelBrowserTest::MakePanelName(int index) { | 612 std::string BasePanelBrowserTest::MakePanelName(int index) { |
| 617 std::string panel_name("Panel"); | 613 std::string panel_name("Panel"); |
| 618 return panel_name + base::IntToString(index); | 614 return panel_name + base::IntToString(index); |
| 619 } | 615 } |
| 620 | 616 |
| 621 bool BasePanelBrowserTest::WmSupportWindowActivation() { | 617 bool BasePanelBrowserTest::WmSupportWindowActivation() { |
| 622 return true; | 618 return true; |
| 623 } | 619 } |
| OLD | NEW |