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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/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/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/extensions/manifest.h" | 18 #include "chrome/common/extensions/manifest.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
22 #include "net/base/mock_host_resolver.h" | 22 #include "net/base/mock_host_resolver.h" |
23 | 23 |
| 24 using extensions::Extension; |
| 25 |
24 class ChromeAppAPITest : public ExtensionBrowserTest { | 26 class ChromeAppAPITest : public ExtensionBrowserTest { |
25 protected: | 27 protected: |
26 bool IsAppInstalled() { return IsAppInstalled(L""); } | 28 bool IsAppInstalled() { return IsAppInstalled(L""); } |
27 bool IsAppInstalled(const std::wstring& frame_xpath) { | 29 bool IsAppInstalled(const std::wstring& frame_xpath) { |
28 std::wstring get_app_is_installed = | 30 std::wstring get_app_is_installed = |
29 L"window.domAutomationController.send(window.chrome.app.isInstalled);"; | 31 L"window.domAutomationController.send(window.chrome.app.isInstalled);"; |
30 bool result; | 32 bool result; |
31 CHECK( | 33 CHECK( |
32 ui_test_utils::ExecuteJavaScriptAndExtractBool( | 34 ui_test_utils::ExecuteJavaScriptAndExtractBool( |
33 browser()->GetSelectedWebContents()->GetRenderViewHost(), | 35 browser()->GetSelectedWebContents()->GetRenderViewHost(), |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 GURL non_app_url(test_file_url.ReplaceComponents(replace_host)); | 299 GURL non_app_url(test_file_url.ReplaceComponents(replace_host)); |
298 | 300 |
299 // Check the install and running state of a non-app iframe running | 301 // Check the install and running state of a non-app iframe running |
300 // within an app. | 302 // within an app. |
301 ui_test_utils::NavigateToURL(browser(), app_url); | 303 ui_test_utils::NavigateToURL(browser(), app_url); |
302 | 304 |
303 EXPECT_EQ("not_installed", InstallState(L"//html/iframe[1]")); | 305 EXPECT_EQ("not_installed", InstallState(L"//html/iframe[1]")); |
304 EXPECT_EQ("cannot_run", RunningState(L"//html/iframe[1]")); | 306 EXPECT_EQ("cannot_run", RunningState(L"//html/iframe[1]")); |
305 EXPECT_FALSE(IsAppInstalled(L"//html/iframe[1]")); | 307 EXPECT_FALSE(IsAppInstalled(L"//html/iframe[1]")); |
306 } | 308 } |
OLD | NEW |