OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 8214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8225 | 8225 |
8226 EXPECT_TRUE(resource); | 8226 EXPECT_TRUE(resource); |
8227 EXPECT_NE(0, resource->loadFinishTime()); | 8227 EXPECT_NE(0, resource->loadFinishTime()); |
8228 | 8228 |
8229 DocumentLoader* loader = document->loader(); | 8229 DocumentLoader* loader = document->loader(); |
8230 | 8230 |
8231 EXPECT_TRUE(loader); | 8231 EXPECT_TRUE(loader); |
8232 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); | 8232 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); |
8233 } | 8233 } |
8234 | 8234 |
| 8235 class CallbackOrderingWebFrameClient : public FrameTestHelpers::TestWebFrameClie
nt { |
| 8236 public: |
| 8237 CallbackOrderingWebFrameClient() : m_callbackCount(0) { } |
| 8238 |
| 8239 void didStartLoading(bool toDifferentDocument) override |
| 8240 { |
| 8241 EXPECT_EQ(0, m_callbackCount++); |
| 8242 FrameTestHelpers::TestWebFrameClient::didStartLoading(toDifferentDocumen
t); |
| 8243 } |
| 8244 void didStartProvisionalLoad(WebLocalFrame*, double) override { EXPECT_EQ(1,
m_callbackCount++); } |
| 8245 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist
oryCommitType) override { EXPECT_EQ(2, m_callbackCount++); } |
| 8246 void didFinishDocumentLoad(WebLocalFrame*, bool documentIsEmpty) override {
EXPECT_EQ(3, m_callbackCount++); } |
| 8247 void didHandleOnloadEvents(WebLocalFrame*) override { EXPECT_EQ(4, m_callbac
kCount++); } |
| 8248 void didFinishLoad(WebLocalFrame*) override { EXPECT_EQ(5, m_callbackCount++
); } |
| 8249 void didStopLoading() override |
| 8250 { |
| 8251 EXPECT_EQ(6, m_callbackCount++); |
| 8252 FrameTestHelpers::TestWebFrameClient::didStopLoading(); |
| 8253 } |
| 8254 |
| 8255 private: |
| 8256 int m_callbackCount; |
| 8257 }; |
| 8258 |
| 8259 TEST_F(WebFrameTest, CallbackOrdering) |
| 8260 { |
| 8261 registerMockedHttpURLLoad("foo.html"); |
| 8262 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8263 CallbackOrderingWebFrameClient client; |
| 8264 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); |
| 8265 } |
| 8266 |
8235 } // namespace blink | 8267 } // namespace blink |
OLD | NEW |