| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "chrome/browser/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 14 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
| 17 #include "chrome/browser/web_applications/web_app.h" | |
| 18 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/common/extensions/extension_constants.h" | 18 #include "chrome/common/extensions/extension_constants.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 23 #include "ui/base/models/menu_model.h" | 22 #include "ui/base/models/menu_model.h" |
| 24 #include "webkit/glue/context_menu.h" | 23 #include "webkit/glue/context_menu.h" |
| 25 | 24 |
| 26 using content::WebContents; | 25 using content::WebContents; |
| 27 | 26 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 51 ExtensionBrowserTest::SetUpCommandLine(command_line); | 50 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 52 command_line->AppendSwitch(switches::kEnablePlatformApps); | 51 command_line->AppendSwitch(switches::kEnablePlatformApps); |
| 53 } | 52 } |
| 54 | 53 |
| 55 protected: | 54 protected: |
| 56 void LoadAndLaunchPlatformApp(const char* name) { | 55 void LoadAndLaunchPlatformApp(const char* name) { |
| 57 ui_test_utils::WindowedNotificationObserver app_loaded_observer( | 56 ui_test_utils::WindowedNotificationObserver app_loaded_observer( |
| 58 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, | 57 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 59 content::NotificationService::AllSources()); | 58 content::NotificationService::AllSources()); |
| 60 | 59 |
| 61 web_app::SetDisableShortcutCreationForTests(true); | |
| 62 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII("platform_apps"). | 60 EXPECT_TRUE(LoadExtension(test_data_dir_.AppendASCII("platform_apps"). |
| 63 AppendASCII(name))); | 61 AppendASCII(name))); |
| 64 | 62 |
| 65 ExtensionService* service = browser()->profile()->GetExtensionService(); | 63 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 66 const Extension* extension = service->GetExtensionById( | 64 const Extension* extension = service->GetExtensionById( |
| 67 last_loaded_extension_id_, false); | 65 last_loaded_extension_id_, false); |
| 68 EXPECT_TRUE(extension); | 66 EXPECT_TRUE(extension); |
| 69 | 67 |
| 70 size_t platform_app_count = GetPlatformAppCount(); | 68 size_t platform_app_count = GetPlatformAppCount(); |
| 71 | 69 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Tests that localStorage and WebSQL are disabled for platform apps. | 212 // Tests that localStorage and WebSQL are disabled for platform apps. |
| 215 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. | 213 // Disabled until shell windows are implemented for non-GTK, non-Views toolkits. |
| 216 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) | 214 #if defined(TOOLKIT_GTK) || defined(TOOLKIT_VIEWS) |
| 217 #define MAYBE_DisallowStorage DisallowStorage | 215 #define MAYBE_DisallowStorage DisallowStorage |
| 218 #else | 216 #else |
| 219 #define MAYBE_DisallowStorage DISABLED_DisallowStorage | 217 #define MAYBE_DisallowStorage DISABLED_DisallowStorage |
| 220 #endif | 218 #endif |
| 221 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowStorage) { | 219 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_DisallowStorage) { |
| 222 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_; | 220 ASSERT_TRUE(RunPlatformAppTest("platform_apps/storage")) << message_; |
| 223 } | 221 } |
| OLD | NEW |