OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/views/apps/app_info_dialog/app_info_dialog_views.h" | 5 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.h" |
6 | 6 |
| 7 #include <memory> |
| 8 |
7 #include "base/macros.h" | 9 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/test_extension_environment.h" | 12 #include "chrome/browser/extensions/test_extension_environment.h" |
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
13 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h" | 14 #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h" |
14 #include "chrome/test/base/browser_with_test_window_test.h" | 15 #include "chrome/test/base/browser_with_test_window_test.h" |
15 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/views/controls/link.h" | 19 #include "ui/views/controls/link.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 EXPECT_FALSE(widget_->IsClosed()); | 148 EXPECT_FALSE(widget_->IsClosed()); |
148 EXPECT_FALSE(widget_destroyed_); | 149 EXPECT_FALSE(widget_destroyed_); |
149 extension_environment_.DeleteProfile(); | 150 extension_environment_.DeleteProfile(); |
150 | 151 |
151 base::RunLoop().RunUntilIdle(); | 152 base::RunLoop().RunUntilIdle(); |
152 EXPECT_TRUE(widget_destroyed_); | 153 EXPECT_TRUE(widget_destroyed_); |
153 } | 154 } |
154 | 155 |
155 // Tests that the dialog does not close when a different profile is destroyed. | 156 // Tests that the dialog does not close when a different profile is destroyed. |
156 TEST_F(AppInfoDialogViewsTest, DestroyedOtherProfileDoesNotCloseDialog) { | 157 TEST_F(AppInfoDialogViewsTest, DestroyedOtherProfileDoesNotCloseDialog) { |
157 scoped_ptr<TestingProfile> other_profile(new TestingProfile); | 158 std::unique_ptr<TestingProfile> other_profile(new TestingProfile); |
158 extension_environment_.CreateExtensionServiceForProfile(other_profile.get()); | 159 extension_environment_.CreateExtensionServiceForProfile(other_profile.get()); |
159 | 160 |
160 scoped_refptr<const extensions::Extension> other_app = | 161 scoped_refptr<const extensions::Extension> other_app = |
161 extension_environment_.MakePackagedApp(kTestOtherExtensionId, false); | 162 extension_environment_.MakePackagedApp(kTestOtherExtensionId, false); |
162 extensions::ExtensionSystem::Get(other_profile.get()) | 163 extensions::ExtensionSystem::Get(other_profile.get()) |
163 ->extension_service() | 164 ->extension_service() |
164 ->AddExtension(other_app.get()); | 165 ->AddExtension(other_app.get()); |
165 | 166 |
166 EXPECT_FALSE(widget_->IsClosed()); | 167 EXPECT_FALSE(widget_->IsClosed()); |
167 EXPECT_FALSE(widget_destroyed_); | 168 EXPECT_FALSE(widget_destroyed_); |
(...skipping 23 matching lines...) Expand all Loading... |
191 content::WebContents* web_contents = tabs->GetWebContentsAt(0); | 192 content::WebContents* web_contents = tabs->GetWebContentsAt(0); |
192 | 193 |
193 std::string url = "https://chrome.google.com/webstore/detail/"; | 194 std::string url = "https://chrome.google.com/webstore/detail/"; |
194 url += kTestExtensionId; | 195 url += kTestExtensionId; |
195 url += "?utm_source=chrome-app-launcher-info-dialog"; | 196 url += "?utm_source=chrome-app-launcher-info-dialog"; |
196 EXPECT_EQ(GURL(url), web_contents->GetURL()); | 197 EXPECT_EQ(GURL(url), web_contents->GetURL()); |
197 | 198 |
198 base::RunLoop().RunUntilIdle(); | 199 base::RunLoop().RunUntilIdle(); |
199 EXPECT_TRUE(widget_destroyed_); | 200 EXPECT_TRUE(widget_destroyed_); |
200 } | 201 } |
OLD | NEW |