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 <memory> |
5 #include <string> | 6 #include <string> |
6 | 7 |
7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/extensions/extension_browsertest.h" | 12 #include "chrome/browser/extensions/extension_browsertest.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
19 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 EXPECT_TRUE(IsAppInstalledInMainFrame()); | 130 EXPECT_TRUE(IsAppInstalledInMainFrame()); |
131 | 131 |
132 // Check that an app page returns the correct result for | 132 // Check that an app page returns the correct result for |
133 // chrome.app.getDetails(). | 133 // chrome.app.getDetails(). |
134 ui_test_utils::NavigateToURL(browser(), app_url); | 134 ui_test_utils::NavigateToURL(browser(), app_url); |
135 ASSERT_TRUE( | 135 ASSERT_TRUE( |
136 content::ExecuteScriptAndExtractString( | 136 content::ExecuteScriptAndExtractString( |
137 browser()->tab_strip_model()->GetActiveWebContents(), | 137 browser()->tab_strip_model()->GetActiveWebContents(), |
138 kGetAppDetails, | 138 kGetAppDetails, |
139 &result)); | 139 &result)); |
140 scoped_ptr<base::DictionaryValue> app_details( | 140 std::unique_ptr<base::DictionaryValue> app_details( |
141 static_cast<base::DictionaryValue*>( | 141 static_cast<base::DictionaryValue*>( |
142 base::JSONReader::Read(result).release())); | 142 base::JSONReader::Read(result).release())); |
143 // extension->manifest() does not contain the id. | 143 // extension->manifest() does not contain the id. |
144 app_details->Remove("id", NULL); | 144 app_details->Remove("id", NULL); |
145 EXPECT_TRUE(app_details.get()); | 145 EXPECT_TRUE(app_details.get()); |
146 EXPECT_TRUE(app_details->Equals(extension->manifest()->value())); | 146 EXPECT_TRUE(app_details->Equals(extension->manifest()->value())); |
147 | 147 |
148 // Try to change app.isInstalled. Should silently fail, so | 148 // Try to change app.isInstalled. Should silently fail, so |
149 // that isInstalled should have the initial value. | 149 // that isInstalled should have the initial value. |
150 ASSERT_TRUE( | 150 ASSERT_TRUE( |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 "app.com", "/extensions/get_app_details_for_frame_reversed.html"); | 231 "app.com", "/extensions/get_app_details_for_frame_reversed.html"); |
232 | 232 |
233 // Check the install and running state of a non-app iframe running | 233 // Check the install and running state of a non-app iframe running |
234 // within an app. | 234 // within an app. |
235 ui_test_utils::NavigateToURL(browser(), app_url); | 235 ui_test_utils::NavigateToURL(browser(), app_url); |
236 | 236 |
237 EXPECT_EQ("not_installed", InstallStateInIFrame()); | 237 EXPECT_EQ("not_installed", InstallStateInIFrame()); |
238 EXPECT_EQ("cannot_run", RunningStateInIFrame()); | 238 EXPECT_EQ("cannot_run", RunningStateInIFrame()); |
239 EXPECT_FALSE(IsAppInstalledInIFrame()); | 239 EXPECT_FALSE(IsAppInstalledInIFrame()); |
240 } | 240 } |
OLD | NEW |