| OLD | NEW |
| 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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "components/exo/buffer.h" | 7 #include "components/exo/buffer.h" |
| 8 #include "components/exo/shell_surface.h" | 8 #include "components/exo/shell_surface.h" |
| 9 #include "components/exo/surface.h" | 9 #include "components/exo/surface.h" |
| 10 #include "components/exo/test/exo_test_base.h" | 10 #include "components/exo/test/exo_test_base.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 TEST_F(ShellSurfaceTest, SetTitle) { | 78 TEST_F(ShellSurfaceTest, SetTitle) { |
| 79 scoped_ptr<Surface> surface(new Surface); | 79 scoped_ptr<Surface> surface(new Surface); |
| 80 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 80 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 81 | 81 |
| 82 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test"))); | 82 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test"))); |
| 83 surface->Commit(); | 83 surface->Commit(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 TEST_F(ShellSurfaceTest, SetApplicationId) { |
| 87 scoped_ptr<Surface> surface(new Surface); |
| 88 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 89 |
| 90 shell_surface->SetToplevel(); |
| 91 surface->Commit(); |
| 92 EXPECT_EQ("", ShellSurface::GetApplicationId( |
| 93 shell_surface->GetWidget()->GetNativeWindow())); |
| 94 shell_surface->SetApplicationId("test"); |
| 95 EXPECT_EQ("test", ShellSurface::GetApplicationId( |
| 96 shell_surface->GetWidget()->GetNativeWindow())); |
| 97 } |
| 98 |
| 86 void DestroyShellSurface(scoped_ptr<ShellSurface>* shell_surface) { | 99 void DestroyShellSurface(scoped_ptr<ShellSurface>* shell_surface) { |
| 87 shell_surface->reset(); | 100 shell_surface->reset(); |
| 88 } | 101 } |
| 89 | 102 |
| 90 TEST_F(ShellSurfaceTest, Move) { | 103 TEST_F(ShellSurfaceTest, Move) { |
| 91 scoped_ptr<Surface> surface(new Surface); | 104 scoped_ptr<Surface> surface(new Surface); |
| 92 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 105 scoped_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
| 93 | 106 |
| 94 // Map shell surface. | 107 // Map shell surface. |
| 95 shell_surface->SetToplevel(); | 108 shell_surface->SetToplevel(); |
| 96 surface->Commit(); | 109 surface->Commit(); |
| 97 | 110 |
| 98 // Post a task that will destroy the shell surface and then start an | 111 // Post a task that will destroy the shell surface and then start an |
| 99 // interactive move. The interactive move should end when surface is | 112 // interactive move. The interactive move should end when surface is |
| 100 // destroyed. | 113 // destroyed. |
| 101 base::MessageLoopForUI::current()->PostTask( | 114 base::MessageLoopForUI::current()->PostTask( |
| 102 FROM_HERE, | 115 FROM_HERE, |
| 103 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); | 116 base::Bind(&DestroyShellSurface, base::Unretained(&shell_surface))); |
| 104 shell_surface->Move(); | 117 shell_surface->Move(); |
| 105 } | 118 } |
| 106 | 119 |
| 107 } // namespace | 120 } // namespace |
| 108 } // namespace exo | 121 } // namespace exo |
| OLD | NEW |