Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/apps/app_shim/app_shim_quit_interactive_uitest_mac.mm

Issue 668903002: Standardize usage of virtual/override/final in chrome/browser/apps/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Tests behavior when quitting apps with app shims. 5 // Tests behavior when quitting apps with app shims.
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/switches.h" 10 #include "apps/switches.h"
(...skipping 18 matching lines...) Expand all
29 29
30 class FakeHost : public apps::AppShimHandler::Host { 30 class FakeHost : public apps::AppShimHandler::Host {
31 public: 31 public:
32 FakeHost(const base::FilePath& profile_path, 32 FakeHost(const base::FilePath& profile_path,
33 const std::string& app_id, 33 const std::string& app_id,
34 ExtensionAppShimHandler* handler) 34 ExtensionAppShimHandler* handler)
35 : profile_path_(profile_path), 35 : profile_path_(profile_path),
36 app_id_(app_id), 36 app_id_(app_id),
37 handler_(handler) {} 37 handler_(handler) {}
38 38
39 virtual void OnAppLaunchComplete(AppShimLaunchResult result) override {} 39 void OnAppLaunchComplete(AppShimLaunchResult result) override {}
40 virtual void OnAppClosed() override { 40 void OnAppClosed() override { handler_->OnShimClose(this); }
41 handler_->OnShimClose(this); 41 void OnAppHide() override {}
42 } 42 void OnAppRequestUserAttention(AppShimAttentionType type) override {}
43 virtual void OnAppHide() override {} 43 base::FilePath GetProfilePath() const override { return profile_path_; }
44 virtual void OnAppRequestUserAttention(AppShimAttentionType type) override {} 44 std::string GetAppId() const override { return app_id_; }
45 virtual base::FilePath GetProfilePath() const override {
46 return profile_path_;
47 }
48 virtual std::string GetAppId() const override { return app_id_; }
49 45
50 private: 46 private:
51 base::FilePath profile_path_; 47 base::FilePath profile_path_;
52 std::string app_id_; 48 std::string app_id_;
53 ExtensionAppShimHandler* handler_; 49 ExtensionAppShimHandler* handler_;
54 50
55 DISALLOW_COPY_AND_ASSIGN(FakeHost); 51 DISALLOW_COPY_AND_ASSIGN(FakeHost);
56 }; 52 };
57 53
58 // Starts an app without a browser window using --load_and_launch_app and 54 // Starts an app without a browser window using --load_and_launch_app and
(...skipping 23 matching lines...) Expand all
82 APP_SHIM_LAUNCH_REGISTER_ONLY, 78 APP_SHIM_LAUNCH_REGISTER_ONLY,
83 std::vector<base::FilePath>()); 79 std::vector<base::FilePath>());
84 EXPECT_EQ(host_.get(), handler_->FindHost(profile(), extension_id_)); 80 EXPECT_EQ(host_.get(), handler_->FindHost(profile(), extension_id_));
85 81
86 // Focus the app window. 82 // Focus the app window.
87 NSWindow* window = [[NSApp windows] objectAtIndex:0]; 83 NSWindow* window = [[NSApp windows] objectAtIndex:0];
88 EXPECT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window)); 84 EXPECT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(window));
89 content::RunAllPendingInMessageLoop(); 85 content::RunAllPendingInMessageLoop();
90 } 86 }
91 87
92 virtual void SetUpCommandLine(CommandLine* command_line) override { 88 void SetUpCommandLine(CommandLine* command_line) override {
93 PlatformAppBrowserTest::SetUpCommandLine(command_line); 89 PlatformAppBrowserTest::SetUpCommandLine(command_line);
94 // Simulate an app shim initiated launch, i.e. launch app but not browser. 90 // Simulate an app shim initiated launch, i.e. launch app but not browser.
95 app_path_ = test_data_dir_ 91 app_path_ = test_data_dir_
96 .AppendASCII("platform_apps") 92 .AppendASCII("platform_apps")
97 .AppendASCII("minimal"); 93 .AppendASCII("minimal");
98 command_line->AppendSwitchNative(apps::kLoadAndLaunchApp, 94 command_line->AppendSwitchNative(apps::kLoadAndLaunchApp,
99 app_path_.value()); 95 app_path_.value());
100 command_line->AppendSwitch(switches::kSilentLaunch); 96 command_line->AppendSwitch(switches::kSilentLaunch);
101 } 97 }
102 98
(...skipping 20 matching lines...) Expand all
123 atStart:NO]; 119 atStart:NO];
124 120
125 // This will time out if the event above does not terminate Chrome. 121 // This will time out if the event above does not terminate Chrome.
126 content::RunMessageLoop(); 122 content::RunMessageLoop();
127 123
128 EXPECT_FALSE(handler_->FindHost(profile(), extension_id_)); 124 EXPECT_FALSE(handler_->FindHost(profile(), extension_id_));
129 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); 125 EXPECT_TRUE(browser_shutdown::IsTryingToQuit());
130 } 126 }
131 127
132 } // namespace apps 128 } // namespace apps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698