| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ash/launcher/chrome_launcher_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowAura); | 642 DISALLOW_COPY_AND_ASSIGN(TestBrowserWindowAura); |
| 643 }; | 643 }; |
| 644 | 644 |
| 645 // Creates a test browser window which has a native window. | 645 // Creates a test browser window which has a native window. |
| 646 scoped_ptr<TestBrowserWindowAura> CreateTestBrowserWindow( | 646 scoped_ptr<TestBrowserWindowAura> CreateTestBrowserWindow( |
| 647 const Browser::CreateParams& params) { | 647 const Browser::CreateParams& params) { |
| 648 // Create a window. | 648 // Create a window. |
| 649 aura::Window* window = new aura::Window(NULL); | 649 aura::Window* window = new aura::Window(NULL); |
| 650 window->set_id(0); | 650 window->set_id(0); |
| 651 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 651 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 652 window->Init(aura::WINDOW_LAYER_TEXTURED); | 652 window->Init(ui::LAYER_TEXTURED); |
| 653 window->Show(); | 653 window->Show(); |
| 654 | 654 |
| 655 scoped_ptr<TestBrowserWindowAura> browser_window( | 655 scoped_ptr<TestBrowserWindowAura> browser_window( |
| 656 new TestBrowserWindowAura(window)); | 656 new TestBrowserWindowAura(window)); |
| 657 browser_window->CreateBrowser(params); | 657 browser_window->CreateBrowser(params); |
| 658 return browser_window.Pass(); | 658 return browser_window.Pass(); |
| 659 } | 659 } |
| 660 | 660 |
| 661 // Watches WebContents and blocks until it is destroyed. This is needed for | 661 // Watches WebContents and blocks until it is destroyed. This is needed for |
| 662 // the destruction of a V2 application. | 662 // the destruction of a V2 application. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 684 }; | 684 }; |
| 685 | 685 |
| 686 // A V1 windowed application. | 686 // A V1 windowed application. |
| 687 class V1App : public TestBrowserWindow { | 687 class V1App : public TestBrowserWindow { |
| 688 public: | 688 public: |
| 689 V1App(Profile* profile, const std::string& app_name) { | 689 V1App(Profile* profile, const std::string& app_name) { |
| 690 // Create a window. | 690 // Create a window. |
| 691 native_window_.reset(new aura::Window(NULL)); | 691 native_window_.reset(new aura::Window(NULL)); |
| 692 native_window_->set_id(0); | 692 native_window_->set_id(0); |
| 693 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP); | 693 native_window_->SetType(ui::wm::WINDOW_TYPE_POPUP); |
| 694 native_window_->Init(aura::WINDOW_LAYER_TEXTURED); | 694 native_window_->Init(ui::LAYER_TEXTURED); |
| 695 native_window_->Show(); | 695 native_window_->Show(); |
| 696 aura::client::ParentWindowWithContext(native_window_.get(), | 696 aura::client::ParentWindowWithContext(native_window_.get(), |
| 697 ash::Shell::GetPrimaryRootWindow(), | 697 ash::Shell::GetPrimaryRootWindow(), |
| 698 gfx::Rect(10, 10, 20, 30)); | 698 gfx::Rect(10, 10, 20, 30)); |
| 699 Browser::CreateParams params = | 699 Browser::CreateParams params = |
| 700 Browser::CreateParams::CreateForApp(kCrxAppPrefix + app_name, | 700 Browser::CreateParams::CreateForApp(kCrxAppPrefix + app_name, |
| 701 true /* trusted_source */, | 701 true /* trusted_source */, |
| 702 gfx::Rect(), | 702 gfx::Rect(), |
| 703 profile, | 703 profile, |
| 704 chrome::HOST_DESKTOP_TYPE_ASH); | 704 chrome::HOST_DESKTOP_TYPE_ASH); |
| (...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 | 2683 |
| 2684 EXPECT_EQ(1, app_icon_loader->fetch_count()); | 2684 EXPECT_EQ(1, app_icon_loader->fetch_count()); |
| 2685 ASSERT_EQ(initial_size + 1, model_->items().size()); | 2685 ASSERT_EQ(initial_size + 1, model_->items().size()); |
| 2686 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); | 2686 EXPECT_TRUE(launcher_controller_->IsAppPinned("1")); |
| 2687 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); | 2687 EXPECT_FALSE(launcher_controller_->IsAppPinned("0")); |
| 2688 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); | 2688 EXPECT_EQ(ash::TYPE_APP_SHORTCUT, model_->items()[app_index].type); |
| 2689 | 2689 |
| 2690 launcher_controller_->UnpinAppWithID("1"); | 2690 launcher_controller_->UnpinAppWithID("1"); |
| 2691 ASSERT_EQ(initial_size, model_->items().size()); | 2691 ASSERT_EQ(initial_size, model_->items().size()); |
| 2692 } | 2692 } |
| OLD | NEW |